FXRuby: Changing the options of FXTextField

Hello,

I want to change the options of a FXTextField to make it read only
(TEXTFIELD_READONLY), but I didn’t find any methods to set options after
the object is created.

Andreas

···


AVR-Tutorial, über 350 Links
Forum für AVRGCC und MSPGCC
-> http://www.mikrocontroller.net

Andreas Schwarz wrote:

Hello,

I want to change the options of a FXTextField to make it read only
(TEXTFIELD_READONLY), but I didn’t find any methods to set options after
the object is created.

You can use

field.enabled = true # or false to gray out the field

or

field.editable = true # or false to prevent editing
# without graying the field

Andreas Schwarz wrote:

I want to change the options of a FXTextField to make it read only
(TEXTFIELD_READONLY), but I didn’t find any methods to set options after
the object is created.

Just set it’s editable attribute to ‘false’:

 textField.editable = false

For more info, see:

 http://www.fxruby.org/doc/api/classes/Fox/FXTextField.html

Hope this helps,

Lyle

Joel VanderWerf wrote:

Andreas Schwarz wrote:

Hello,

I want to change the options of a FXTextField to make it read only
(TEXTFIELD_READONLY), but I didn’t find any methods to set options after
the object is created.

You can use

field.enabled = true # or false to gray out the field

undefined method `enabled=’ for :Fox::FXTextField (NameError)
:frowning:

···


AVR-Tutorial, über 350 Links
Forum für AVRGCC und MSPGCC
http://www.mikrocontroller.net

Andreas Schwarz wrote:

Joel VanderWerf wrote:

Andreas Schwarz wrote:

Hello,

I want to change the options of a FXTextField to make it read only
(TEXTFIELD_READONLY), but I didn’t find any methods to set options after
the object is created.

You can use

field.enabled = true # or false to gray out the field

undefined method `enabled=’ for :Fox::FXTextField (NameError)
:frowning:

Oops, for convenience I define:

class FXWindow
alias :enabled :enabled? unless instance_methods.include?(“enabled”)
unless instance_methods.include?(“enabled=”)
def enabled=(x); x ? enable : disable; end
end
end