It is currently Mon Aug 26, 2019 8:20 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: SplitterGadget whith mouse.
PostPosted: Sun Jun 02, 2019 8:07 pm 
Offline
User
User

Joined: Sun Jan 10, 2010 7:32 pm
Posts: 10
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: SplitterGadget whith mouse.
PostPosted: Sun Jun 02, 2019 8:18 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 441
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: SplitterGadget whith mouse.
PostPosted: Mon Jun 03, 2019 8:49 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 630
Location: France
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)

_________________
English is not my native language, I use an online translator


Top
 Profile  
Reply with quote  
 Post subject: Re: SplitterGadget whith mouse.
PostPosted: Mon Jun 03, 2019 2:11 pm 
Offline
User
User

Joined: Sun Jan 10, 2010 7:32 pm
Posts: 10
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: SplitterGadget whith mouse.
PostPosted: Thu Jun 06, 2019 4:30 am 
Offline
User
User

Joined: Sun Jan 10, 2010 7:32 pm
Posts: 10
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


Top
 Profile  
Reply with quote  
 Post subject: Re: SplitterGadget whith mouse.
PostPosted: Thu Jun 06, 2019 5:13 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Dec 29, 2011 5:03 pm
Posts: 441
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:
; 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


Top
 Profile  
Reply with quote  
 Post subject: Re: SplitterGadget whith mouse.
PostPosted: Thu Jun 06, 2019 8:37 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Feb 08, 2014 3:26 pm
Posts: 630
Location: France
Quote:
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:
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:
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)

Quote:
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)

_________________
English is not my native language, I use an online translator


Top
 Profile  
Reply with quote  
 Post subject: Re: SplitterGadget whith mouse.
PostPosted: Thu Jun 06, 2019 7:16 pm 
Offline
User
User

Joined: Sun Jan 10, 2010 7:32 pm
Posts: 10
Marc56us wrote:
Quote:
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:
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:
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye