Window like PureBasic IDE

You need some new stunning features ? Tell us here.
User avatar
thinkitsimple
User
User
Posts: 89
Joined: Mon Aug 13, 2012 6:12 pm
Location: Berlin, Germany
Contact:

Window like PureBasic IDE

Post by thinkitsimple »

Hi,

i want to create a window with an layout like the PureBasic IDE.

A Listview to the left for example and a vertical scrollable area where i place some StringGadgets. This separated by a SplitterGadget.

So what gadget should i use to group the StringGadgets in a scrollable area so the user can scroll vertical when the window is to small in height?

In short: how do i create a layout like the PureBasic IDE?

Michael
Michael

PureBasic 5.51, macOS 10.12.2 Sierra
User avatar
Kiffi
Addict
Addict
Posts: 1502
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Window like PureBasic IDE

Post by Kiffi »

thinkitsimple wrote:So what gadget should i use to group the StringGadgets in a scrollable area so the user can scroll vertical when the window is to small in height?
ScrollAreaGadget() -> http://www.purebasic.com/documentation/ ... adget.html

Greetings ... Peter
Hygge
User avatar
thinkitsimple
User
User
Posts: 89
Joined: Mon Aug 13, 2012 6:12 pm
Location: Berlin, Germany
Contact:

Re: Window like PureBasic IDE

Post by thinkitsimple »

That works. Thanks.

Another question: If i run this window inside the ide, the SplitterGadget with its two embedded gadgets (ScrollArea and ListView) is locked at all 4 positions which is good and which is what i told the splitter.

But when i run the app and open the same window containing this gadgets (Splitter with ScrollArea and ListView) and resize the Window, the gadgets wont be resized.

What can cause this?
Michael

PureBasic 5.51, macOS 10.12.2 Sierra
User avatar
thinkitsimple
User
User
Posts: 89
Joined: Mon Aug 13, 2012 6:12 pm
Location: Berlin, Germany
Contact:

Re: Window like PureBasic IDE

Post by thinkitsimple »

ok, without some code this seems to be a little hard to understand.

I have a Window with a SplitterGadget. First Gadget in there is a ScrollAreaGadget and second Gadget is a ListIconGadget.

I now want the SplitterGadget to expand to the size of the windows when it is resizing. This works fine when i run the form inside the ide. But when i run den main.pb which includes the SplitterWindow, the ResizeEvent seem not to work.

This is the code of the Window, created by the form-designer:

Code: Select all

;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;

Enumeration FormWindow
  #SplitterWnd
EndEnumeration

Enumeration FormGadget
  #ScrollArea_0
  #String_1
  #Text_1
  #String_2
  #Text_2
  #String_3
  #Text_3
  #String_4
  #Text_4
  #String_5
  #Text_5
  #String_6
  #Text_6
  #String_7
  #Text_7
  #String_8
  #Text_8
  #String_9
  #Text_9
  #String_10
  #Text_10
  #ListIcon_0
  #Splitter_1
EndEnumeration

Enumeration FormMenu
  #Toolbar_0
EndEnumeration

Enumeration FormImage
  #Img_SplitterWnd_0
EndEnumeration

UsePNGImageDecoder()

LoadImage(#Img_SplitterWnd_0,"/Users/michael/Entwicklung/Xojo/uniformis/publish/UniFormis-Icons/toolbar/plus_32.png")

Declare ResizeGadgetsSplitterWnd()


Procedure OpenSplitterWnd(x = 0, y = 0, width = 1140, height = 560)
  OpenWindow(#SplitterWnd, x, y, width, height, "", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  CreateToolBar(0, WindowID(#SplitterWnd))
  ToolBarImageButton(#Toolbar_0,ImageID(#Img_SplitterWnd_0))
  CreateStatusBar(0, WindowID(#SplitterWnd))
  AddStatusBarField(50)
  StatusBarText(0, 0, "Status")
  ScrollAreaGadget(#ScrollArea_0, 0, ToolBarHeight(0) + 0, 263, 536, 250, 536, 1)
  StringGadget(#String_1, 10, 30, 230, 20, "1")
  TextGadget(#Text_1, 10, 10, 230, 20, "1")
  StringGadget(#String_2, 10, 80, 230, 20, "2")
  TextGadget(#Text_2, 10, 60, 230, 20, "2")
  StringGadget(#String_3, 10, 130, 230, 20, "3")
  TextGadget(#Text_3, 10, 110, 230, 20, "3")
  StringGadget(#String_4, 10, 180, 230, 20, "4")
  TextGadget(#Text_4, 10, 160, 230, 20, "4")
  StringGadget(#String_5, 10, 230, 230, 20, "5")
  TextGadget(#Text_5, 10, 210, 230, 20, "5")
  StringGadget(#String_6, 10, 280, 230, 20, "6")
  TextGadget(#Text_6, 10, 260, 230, 20, "6")
  StringGadget(#String_7, 10, 330, 230, 20, "7")
  TextGadget(#Text_7, 10, 310, 230, 20, "7")
  StringGadget(#String_8, 10, 380, 230, 20, "8")
  TextGadget(#Text_8, 10, 360, 230, 20, "8")
  StringGadget(#String_9, 10, 430, 230, 20, "9")
  TextGadget(#Text_9, 10, 410, 230, 20, "9")
  StringGadget(#String_10, 10, 480, 230, 20, "10")
  TextGadget(#Text_10, 10, 460, 230, 20, "10")
  CloseGadgetList()
  ListIconGadget(#ListIcon_0, 275, ToolBarHeight(0) + 0, 865, 536, "Column 1", 100)
  SplitterGadget(#Splitter_1, 0, ToolBarHeight(0) + 0, 1140, 536, #ScrollArea_0, #ListIcon_0, #PB_Splitter_Vertical)
  SetGadgetState(#Splitter_1, 263)
EndProcedure

Procedure ResizeGadgetsSplitterWnd()
  Protected FormWindowWidth, FormWindowHeight
  FormWindowWidth = WindowWidth(#SplitterWnd)
  FormWindowHeight = WindowHeight(#SplitterWnd)
  ResizeGadget(#Splitter_1, 0, ToolBarHeight(0) + 0, FormWindowWidth - 0, FormWindowHeight - ToolBarHeight(0) - StatusBarHeight(0) - 0)
EndProcedure

Procedure SplitterWnd_Events(event)
  Select event
    Case #PB_Event_SizeWindow
      ResizeGadgetsSplitterWnd()
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
        Case #Toolbar_0
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure
Michael

PureBasic 5.51, macOS 10.12.2 Sierra
User avatar
thinkitsimple
User
User
Posts: 89
Joined: Mon Aug 13, 2012 6:12 pm
Location: Berlin, Germany
Contact:

Re: Window like PureBasic IDE

Post by thinkitsimple »

OK, it was my fault.

I did not use PB_Any for the Window Properties and obviously something went wrong with my Enumeration. Change it back to #PB_Any and now my Second Windows resizes like expected.

Michael
Michael

PureBasic 5.51, macOS 10.12.2 Sierra
Post Reply