Noob question about layout in FXRuby

A

Arie van Wingerden

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.freedonation.com
Kijk op / look at http://www.dorcas.nl & http://www.dorcas.net
 
M

Meinrad Recheis

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 f= rom
the FXRuby user's guide).
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
require 'fox14'
include Fox
theApp =3D FXApp.new
theMainWindow =3D FXMainWindow.new(theApp,
"Hello",nil,nil,DECOR_ALL,300,300,300,300)
inField =3D FXTextField.new(theMainWindow,40,nil,0,TEXTFIELD_NORMAL,40,40= )
outField =3D FXTextField.new(theMainWindow,40,nil,0,TEXTFIELD_NORMAL,40,8= 0)
theButton =3D FXButton.new(theMainWindow, "Hello,
World!",nil,nil,0,BUTTON_NORMAL,40,60)
theButton.tipText =3D "Push Me!"
theButton.connect(SEL_COMMAND) do
outField.text =3D inField.text
end
FXToolTip.new(theApp)
theApp.create
theMainWindow.show
theApp.run
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
My first problem is:
I use a X and Y coordinate for the 2 textfields and the button, but t= hey
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 us= e
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

-- henon
 
A

Arie van Wingerden

Thanks!

"Meinrad Recheis" <[email protected]> schreef in bericht
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?
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

-- henon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top