I have the following (1.0.20) code. All FXTextFields are set to a default
width, regardless of what I pass the constructor or set afterwards. What am
I doing wrong?
class DBLogin < FXMainWindow
include Responder
attr_accessor :dblogin
def initialize(app)
@app = app
super(@app, "Login", nil, nil, DECOR_ALL, 0, 0, 400)
FXLabel.new(self, 'Server')
@server = FXTextField.new(self, 1, nil, 0, TEXTFIELD_NORMAL, 0, 0,
- FXLabel.new(self, ‘Database’)
@database = FXTextField.new(self, 1)
FXLabel.new(self, ‘User’)
@username = FXTextField.new(self, 1)
FXLabel.new(self, ‘Password’)
@password = FXTextField.new(self, 1)
…
If you want to specify the width (or height) of a widget, you must specifiy that you are doing so.
FXTextField(self, 1, nil, 0, LAYOUT_FIX_WIDTH, 0, 0, 500)
this threw me off for a while as well
I kinda wish you could do this automagically by passing in ‘nil’ for the values you don’t want to
specify. What do ya think, Lyle?
Jason
···
— Chris Morris chrismo@clabs.org wrote:
I have the following (1.0.20) code. All FXTextFields are set to a default
width, regardless of what I pass the constructor or set afterwards. What am
I doing wrong?
class DBLogin < FXMainWindow
include Responder
attr_accessor :dblogin
def initialize(app)
@app = app
super(@app, "Login", nil, nil, DECOR_ALL, 0, 0, 400)
FXLabel.new(self, 'Server')
@server = FXTextField.new(self, 1, nil, 0, TEXTFIELD_NORMAL, 0, 0,
- FXLabel.new(self, ‘Database’)
@database = FXTextField.new(self, 1)
FXLabel.new(self, ‘User’)
@username = FXTextField.new(self, 1)
FXLabel.new(self, ‘Password’)
@password = FXTextField.new(self, 1)
…
Hi,
First of all, the second parameter in the constructor of FXTextField tells FOX
how many characters in the textfield should at least be visible… so 1 is
kind of small.
Second, if you want to specify the width or height by pixels, you need to pass
LAYOUT_FIX_WIDTH or LAYOUT_FIX_HEIGHT to the options parameter. (then the 500
for example will be actually be used for example). Ofcourse most of the time
its better to say LAYOUT_FILL_X, so that it will take as much space there is
available.
Hope this helps,
Sander
···
On Monday 24 February 2003 08:18 pm, Chris Morris wrote:
I have the following (1.0.20) code. All FXTextFields are set to a default
width, regardless of what I pass the constructor or set afterwards. What am
I doing wrong?
class DBLogin < FXMainWindow
include Responder
attr_accessor :dblogin
def initialize(app)
@app = app
super(@app, "Login", nil, nil, DECOR_ALL, 0, 0, 400)
FXLabel.new(self, 'Server')
@server = FXTextField.new(self, 1, nil, 0, TEXTFIELD_NORMAL, 0, 0,
- FXLabel.new(self, ‘Database’)
@database = FXTextField.new(self, 1)
FXLabel.new(self, ‘User’)
@username = FXTextField.new(self, 1)
FXLabel.new(self, ‘Password’)
@password = FXTextField.new(self, 1)
…
–
Outside of a dog, a book is a man’s best friend. Inside of a dog, it’s too
dark to read.
For some goofy reason I read the 2nd parameter as columns, like columns in
multiple column list box or somesuch. 1 is pretty small … lessee …
hey, that works a lot better with a reasonable number in there.
Thx.
···
----- Original Message -----
From: “Sander Jansen” sander@knology.net
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Monday, February 24, 2003 8:45 PM
Subject: Re: FXRuby FXText width?
Hi,
First of all, the second parameter in the constructor of FXTextField tells
FOX
how many characters in the textfield should at least be visible… so 1 is
kind of small.
Second, if you want to specify the width or height by pixels, you need to
pass
LAYOUT_FIX_WIDTH or LAYOUT_FIX_HEIGHT to the options parameter. (then the
500
for example will be actually be used for example). Ofcourse most of the time
its better to say LAYOUT_FILL_X, so that it will take as much space there is
available.
Hope this helps,
Sander
On Monday 24 February 2003 08:18 pm, Chris Morris wrote:
I have the following (1.0.20) code. All FXTextFields are set to a default
width, regardless of what I pass the constructor or set afterwards. What
am
I doing wrong?
class DBLogin < FXMainWindow
include Responder
attr_accessor :dblogin
def initialize(app)
@app = app
super(@app, "Login", nil, nil, DECOR_ALL, 0, 0, 400)
FXLabel.new(self, 'Server')
@server = FXTextField.new(self, 1, nil, 0, TEXTFIELD_NORMAL, 0, 0,
- FXLabel.new(self, ‘Database’)
@database = FXTextField.new(self, 1)
FXLabel.new(self, ‘User’)
@username = FXTextField.new(self, 1)
FXLabel.new(self, ‘Password’)
@password = FXTextField.new(self, 1)
…
–
Outside of a dog, a book is a man’s best friend. Inside of a dog, it’s too
dark to read.