[FXRuby] Splitter

Hi all,

I use the FXSplitter to split my windows into two

parts. Using the mouse I can now adjust the two
halfs (group1, group2) of the window as I like.

Suppose I want to set this new value again when
I restart the application. How do I specify that
group one should be 90% of the window-size?

Thank you,
-A
P.S. the code looks like:

···


require “fox”

include Fox

application = FXApp.new(“Hello”, “FoxTest”)
main = FXMainWindow.new(application, “Hello”, nil, nil, DECOR_ALL)

splitter = FXSplitter.new(main, (LAYOUT_SIDE_TOP|LAYOUT_FILL_X|
LAYOUT_FILL_Y|
SPLITTER_TRACKING|SPLITTER_VERTICAL|SPLITTER_REVERSED))

group1 = FXVerticalFrame.new(splitter,
FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0,
0,0,0,0)
group2 = FXVerticalFrame.new(splitter,
FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y)

FXButton.new(group1, “b1”, nil, nil, 0,
FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_ROW)

FXButton.new(group2, “b2”, nil, nil, 0,
FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_ROW)

#How can I make group1 to take 90% of the overall window?

application.create()
main.show(PLACEMENT_SCREEN)
application.run()

Armin Roehrl wrote:

Hi all,

I use the FXSplitter to split my windows into two
parts. Using the mouse I can now adjust the two
halfs (group1, group2) of the window as I like.

Suppose I want to set this new value again when
I restart the application. How do I specify that
group one should be 90% of the window-size?

Hi, Armin!

I’m still clumsy with Fox, but here’s a thought.

Maybe you can find the width of the parent, then manually
calculate the widths of group1 and group2 and set them.

By the time I looked up the method names, you’d have
figured it out anyway. :slight_smile:

Hal

Armin Roehrl wrote:

Suppose I want to set this new value again when
I restart the application. How do I specify that
group one should be 90% of the window-size?

Hal Fulton’s response contains the gist of the idea. Here’s some more
information from the FOX Community Wiki site:

http://www.fifthplanet.net/cgi-bin/wiki.pl?Cookbook/Setting_The_Relative_Sizes_Of_Panes_In_An_FXSplitter

Hope this helps,

Lyle