# Noob question about layout in FXRuby

**URL:** <https://www.ruby-forum.com/t/noob-question-about-layout-in-fxruby/55629>\
**Category:** Ruby\
**Created:** [March 22, 2006, 4:35pm UTC](https://www.ruby-forum.com/t/noob-question-about-layout-in-fxruby/55629 "2006-03-22T16:35:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arie\_van\_Wingerden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@Arie\_van\_Wingerden](https://www.ruby-forum.com/u/Arie_van_Wingerden)\
**Post date:** [March 22, 2006, 4:35pm UTC](https://www.ruby-forum.com/t/noob-question-about-layout-in-fxruby/55629/1 "2006-03-22T16:35:52Z")

</div>

Hi all,

I am new to Ruby as well as FXRuby.  
When I tried to dig in, I wrote the next small program (which I derived  
from  
the FXRuby user’s guide).  
#====================================================================  
require ‘fox14’  
include Fox  
theApp = FXApp.new  
theMainWindow = FXMainWindow.new(theApp,  
“Hello”,nil,nil,DECOR\_ALL,300,300,300,300)  
inField = FXTextField.new(theMainWindow,40,nil,0,TEXTFIELD\_NORMAL,40,40)  
outField =  
FXTextField.new(theMainWindow,40,nil,0,TEXTFIELD\_NORMAL,40,80)  
theButton = FXButton.new(theMainWindow, “Hello,  
World!”,nil,nil,0,BUTTON\_NORMAL,40,60)  
theButton.tipText = “Push Me!”  
theButton.connect(SEL\_COMMAND) do  
outField.text = inField.text  
end  
FXToolTip.new(theApp)  
theApp.create  
theMainWindow.show  
theApp.run  
#====================================================================  
My first problem is:  
I use a X and Y coordinate for the 2 textfields and the button, but  
they  
seem to be ignored. Why?

Second problem:  
the second parameter for FXTextField.new seems to determine the  
width of  
the field; however, there is also a separate width parameter,  
which doesn’t seem to work.What is the difference and how should I  
use  
them?

Third (question):  
the FXRuby user’s guide does some introductory stuff, but then  
leaves  
all the rest to the programmer. Is there a better, more consistent  
introductory document available?

–  
Met vriendelijke groet / with kind regards,  
Arie van Wingerden

Doneer gratis op / donate free at [http://www.voedselhulp.nl](http://www.voedselhulp.nl) &  
[http://www.freedonation.com](http://www.freedonation.com)  
Kijk op / look at [http://www.dorcas.nl](http://www.dorcas.nl) & [http://www.dorcas.net](http://www.dorcas.net)

---

<div class="post-metadata">

**Author:** ![Arie\_van\_Wingerden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@Arie\_van\_Wingerden](https://www.ruby-forum.com/u/Arie_van_Wingerden)\
**Post date:** [March 22, 2006, 9:48pm UTC](https://www.ruby-forum.com/t/noob-question-about-layout-in-fxruby/55629/2 "2006-03-22T21:48:02Z")

</div>

On 3/22/06, Arie van Wingerden [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> “Hello”,nil,nil,DECOR\_ALL,300,300,300,300)  
> theMainWindow.show  
> theApp.run  
> #====================================================================  
> My first problem is:  
> I use a X and Y coordinate for the 2 textfields and the button, but they  
> seem to be ignored. Why?  
> its overridden by your layout hints. use LAYOUT\_FIX\_X|LAYOUT\_FIX\_Y if  
> you want to position widgets explicitly

> Second problem:  
> the second parameter for FXTextField.new seems to determine the width of  
> the field; however, there is also a separate width parameter,  
> which doesn’t seem to work.What is the difference and how should I use  
> them?

the “numColumns” attribute of textfield overwrites the “width”. same  
here. use LAYOUT\_FIX\_WIDTH to make width effective instead of  
numColumns.

> Third (question):  
> the FXRuby user’s guide does some introductory stuff, but then leaves  
> all the rest to the programmer. Is there a better, more consistent  
> introductory document available?  
> not yet. what you would want to read is what Mike Parr is currently  
> writing. a very detailed introduction to foxGUIb and fxruby. however  
> it is not finished yet. in the meanwhile you could download foxGUIb  
> (or even better check it’s latest version out of CVS).  
> foxGUIb let’s you play around with most of the parameters of most  
> common widgets and layout containers. it is a good start for learning  
> fxruby. check it out at: [http://rubyforge.org/fox-tool](http://rubyforge.org/fox-tool)

– henon

---

<div class="post-metadata">

**Author:** ![Arie\_van\_Wingerden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@Arie\_van\_Wingerden](https://www.ruby-forum.com/u/Arie_van_Wingerden)\
**Post date:** [March 22, 2006, 9:50pm UTC](https://www.ruby-forum.com/t/noob-question-about-layout-in-fxruby/55629/3 "2006-03-22T21:50:48Z")

</div>

> [http://rubyforge.org/fox-tool](http://rubyforge.org/fox-tool)  
> sorry the correct link is:  
> [http://rubyforge.org/projects/fox-tool/](http://rubyforge.org/projects/fox-tool/)

---

<div class="post-metadata">

**Author:** ![Arie\_van\_Wingerden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@Arie\_van\_Wingerden](https://www.ruby-forum.com/u/Arie_van_Wingerden)\
**Post date:** [March 23, 2006, 12:59pm UTC](https://www.ruby-forum.com/t/noob-question-about-layout-in-fxruby/55629/4 "2006-03-23T12:59:00Z")

</div>

Thanks!

“Meinrad R.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) schreef in bericht  
news:removed\_email\_address@domain.invalid…  
On 3/22/06, Arie van Wingerden [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> theMainWindow = FXMainWindow.new(theApp,  
> theApp.create  
> theMainWindow.show  
> theApp.run  
> #====================================================================  
> My first problem is:  
> I use a X and Y coordinate for the 2 textfields and the button, but  
> they  
> seem to be ignored. Why?  
> its overridden by your layout hints. use LAYOUT\_FIX\_X|LAYOUT\_FIX\_Y if  
> you want to position widgets explicitly

> Second problem:  
> the second parameter for FXTextField.new seems to determine the width  
> of  
> the field; however, there is also a separate width parameter,  
> which doesn’t seem to work.What is the difference and how should I use  
> them?

the “numColumns” attribute of textfield overwrites the “width”. same  
here. use LAYOUT\_FIX\_WIDTH to make width effective instead of  
numColumns.

> Third (question):  
> the FXRuby user’s guide does some introductory stuff, but then leaves  
> all the rest to the programmer. Is there a better, more consistent  
> introductory document available?  
> not yet. what you would want to read is what Mike Parr is currently  
> writing. a very detailed introduction to foxGUIb and fxruby. however  
> it is not finished yet. in the meanwhile you could download foxGUIb  
> (or even better check it’s latest version out of CVS).  
> foxGUIb let’s you play around with most of the parameters of most  
> common widgets and layout containers. it is a good start for learning  
> fxruby. check it out at: [http://rubyforge.org/fox-tool](http://rubyforge.org/fox-tool)

– henon
