[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help with FXRuby widgets layout

Ruby Ruby

9/20/2003 7:34:00 PM

Hello World,
I am trying to write a GUI ruby program using FXRuby.
I am having some difficulties laying out the buttons,
text fields and other widgets. I have been able to
place these objects underneath each other, but that's
not what I want.
I would like to have a label with an entry field to
the right of it.
For example:

First Name:_______________ Middle Name:______________
Last Name:________________

Phones - Office:_________ Home:__________
Cell:________
Fax:____________
Pager:_______________

button1 button1 Etc.

I could create all of the above stacked.
I've been reading the layout manager but can't find
any example on how to do this.
Any help will be appreciated.

Thank you

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder...

1 Answer

Lyle Johnson

9/22/2003 3:53:00 PM

0

Ruby Ruby wrote:

> I am trying to write a GUI ruby program using FXRuby.
> I am having some difficulties laying out the buttons,
> text fields and other widgets. I have been able to
> place these objects underneath each other, but that''s
> not what I want.
> I would like to have a label with an entry field to
> the right of it.
> For example:

<snip>

For this kind of layout you''ll usually need to nest layout managers
inside of each other. It takes some experimentation at first, but after
some practice it will become more natural to "see" which combinations of
layout managers are appropriate for a given GUI.

For the case you''re describing, you''ll probably work with a collection
of FXHorizontalFrames stacked on top of each other, perhaps inside an
FXVerticalFrame:

stack = FXVerticalFrame.new(parent, ...)
row1 = FXHorizontalFrame.new(stack, LAYOUT_FILL_X)
row2 = FXHorizontalFrame.new(stack, LAYOUT_FILL_X)
row3 = FXHorizontalFrame.new(stack, LAYOUT_FILL_X)
row4 = FXHorizontalFrame.new(stack, LAYOUT_FILL_X)
#
# ... and so on ...
#

An FXHorizontalFrame lays out its child widgets from left to right
(horizontally), so the widgets in ''row1'' would be added like this:

FXLabel.new(row1, "First Name:")
FXTextField.new(row1, ...)
FXLabel.new(row1, "Middle Name:")
FXTextField.new(row1, ...)

Continuing on down the form,

FXLabel.new(row2, "Last Name:")
FXTextField.new(row2, ...)

FXLabel.new(row3, "Phones - Office:")
FXTextField.new(row3, ...)
FXLabel.new(row3, "Home:")
FXTextField.new(row3, ...)

and so on.

Hope this helps,

Lyle