SplitterGadget whith mouse.

You need some new stunning features ? Tell us here.
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

SplitterGadget whith mouse.

Post by bloiiing »

Hello,

I'm trying to setup a splittergadget and it is not working as expected. I need help because I don't know how to do what I want.

Problem: I have one container which contains a text label an a text editor. I duplicate this container. So I have 2 containers with a text label and a text editor in each one. So I would like to put this 2 containers in a splittergadget verticaly. To do that, I draw a splitter choosing container_0 and container_1 and start drawing button. After I draw the splitter to encompass the 2 containers... The result is an empty splittergadget et text labels and editors out of containers.

Questions: How could I setup the splittergadget? Or how could I put text labels and editors inside containers and containers inside splittergadget after drawing the splittergadget? Can I do this using the Form Designer with mouse and without coding manually (because the source of the Form is regenerated each time making manual coding obsolete each saving the Form.pbf file) ?

Thank you in advance.
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: SplitterGadget whith mouse.

Post by wombats »

The gadgets you want to be in the containers need to have their 'Parent' property set as the relevant ContainerGadget. Have you done that?

I'm not sure if the Form Designer handles resizing, but normally, when you have a ContainerGadget inside a SplitterGadget, only the ContainerGadget is resized when the splitter is moved. The gadgets inside the ContainerGadget need to be resized manually.
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: SplitterGadget whith mouse.

Post by Marc56us »

The Form Designer "ejects" gadgets when you put a splitter around a ContainerGadget. (Bug?)
To counter this, you can do
- Make the container
- Put the gadgets (with the Parent property in the desired container)
- Trace the splitter
- Take back each gadget and give it the Parent property to the desired container, because it has been ejected from ContainerGadget.

The gadgets in the containers are well resized when the window changes size (but not when the splitter moves, which is normal)

(Tested)
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: SplitterGadget whith mouse.

Post by bloiiing »

Marc56us wrote:The Form Designer "ejects" gadgets when you put a splitter around a ContainerGadget. (Bug?)
To counter this, you can do
- Make the container
- Put the gadgets (with the Parent property in the desired container)
- Trace the splitter
- Take back each gadget and give it the Parent property to the desired container, because it has been ejected from ContainerGadget.

The gadgets in the containers are well resized when the window changes size (but not when the splitter moves, which is normal)

(Tested)
All right, I am going to try this.

Thank you. Have nice day!
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: SplitterGadget whith mouse.

Post by bloiiing »

Marc56us wrote:The Form Designer "ejects" gadgets when you put a splitter around a ContainerGadget. (Bug?)
To counter this, you can do

- Take back each gadget and give it the Parent property to the desired container, because it has been ejected from ContainerGadget.

The gadgets in the containers are well resized when the window changes size (but not when the splitter moves, which is normal)

(Tested)
Hello, It doesn't works because I can't choose the parent. It give me only window_0 as possible parent.

There is another bug under linux. The text in text editor is not visual selected when selected with mouse. But Ctrl+c and Ctrl+v works fine.

Thanks for answered me
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: SplitterGadget whith mouse.

Post by wombats »

Are you definitely trying to set the parent for the right gadget?

Is this essentially what you're trying to do? Save it as a .pbf file to open it as a form in the IDE.

Code: Select all

; Form Designer for Purebasic - 5.71
; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again.

;
; 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.
;

Global Window_0

Global Container_0, String_0, Container_1, String_1, Splitter_0


Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
  Container_0 = ContainerGadget(#PB_Any, 10, 10, 570, 160)
  String_0 = StringGadget(#PB_Any, 0, 0, 130, 30, "")
  CloseGadgetList()
  Container_1 = ContainerGadget(#PB_Any, 10, 182, 570, 148)
  String_1 = StringGadget(#PB_Any, 0, 0, 130, 30, "")
  CloseGadgetList()
  Splitter_0 = SplitterGadget(#PB_Any, 10, 10, 570, 320, Container_0, Container_1)
  SetGadgetState(Splitter_0, 160)
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: SplitterGadget whith mouse.

Post by Marc56us »

It doesn't works because I can't choose the parent. It give me only window_0 as possible parent.
Follow the order indicated: (draw containers first)
1. Draw Container_0 and Container_1
2. Draw Gadget(s)
3. For each gadget, select 'Parent' (you see Container_0 and Container_1 in dialog box)
4. Draw Splitter gadget
5. Under Linux: Bug, Form Designer re-order in bad way :-( you need to edit code
5.1 Linux Change order lines in .pbf

Code: Select all

Container_Gadget_0
...
CloseGadgetList()

Container_Gadget_1
...
CloseGadgetList()

SplitterGadget(...
Yes, you can edit the order of the gadgets in the code. It will be preserved even when returning to Design View Mode.

Sample of edited code.

Code: Select all

Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
  
  ContainerGadget(#Container_0, 20, 10, 510, 175)
  EditorGadget(#Editor_0, 10, 20, 440, 90)
  CloseGadgetList()
  
  ContainerGadget(#Container_1, 20, 194, 510, 166)
  ImageGadget(#Image_0, 20, 20, 420, 110, 0)
  CloseGadgetList()
  
  SplitterGadget(#Splitter_0, 20, 10, 510, 350, #Container_0, #Container_1, #PB_Splitter_Separator)
  SetGadgetState(#Splitter_0, 175)
EndProcedure
After that, you can add gadget in normal way (set parent to container for each new gadget)
There is another bug under linux. The text in text editor is not visual selected when selected with mouse. But Ctrl+c and Ctrl+v works fine.
If you can't access to gadget by mouse, uses tab 'Object' in panel
Image

Tested on a real Linux distribution (Slackware)
bloiiing
User
User
Posts: 14
Joined: Sun Jan 10, 2010 7:32 pm

Re: SplitterGadget whith mouse.

Post by bloiiing »

Marc56us wrote:
It doesn't works because I can't choose the parent. It give me only window_0 as possible parent.
Follow the order indicated: (draw containers first)
1. Draw Container_0 and Container_1
2. Draw Gadget(s)
3. For each gadget, select 'Parent' (you see Container_0 and Container_1 in dialog box)
4. Draw Splitter gadget
5. Under Linux: Bug, Form Designer re-order in bad way :-( you need to edit code
5.1 Linux Change order lines in .pbf

Code: Select all

Container_Gadget_0
...
CloseGadgetList()

Container_Gadget_1
...
CloseGadgetList()

SplitterGadget(...
Yes, you can edit the order of the gadgets in the code. It will be preserved even when returning to Design View Mode.

Sample of edited code.

Code: Select all

Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
  OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
  
  ContainerGadget(#Container_0, 20, 10, 510, 175)
  EditorGadget(#Editor_0, 10, 20, 440, 90)
  CloseGadgetList()
  
  ContainerGadget(#Container_1, 20, 194, 510, 166)
  ImageGadget(#Image_0, 20, 20, 420, 110, 0)
  CloseGadgetList()
  
  SplitterGadget(#Splitter_0, 20, 10, 510, 350, #Container_0, #Container_1, #PB_Splitter_Separator)
  SetGadgetState(#Splitter_0, 175)
EndProcedure
After that, you can add gadget in normal way (set parent to container for each new gadget)
I am going to try this solution. I will let you know the result. Thanks for your idea and this information.
Post Reply