From: Rich Date: 2004-06-06T23:40:00+09:00 Subject: Re: Elementary FXDialogBox query Referencing an FXTextField directly should se the FXTextField class. FXTextFields have the read/write property 'text' that holds a string representation of the information in the text field. When you reference an FXTextField directly, but then call it's 'to_s' method, it will give you the same value as it's text property. Here's some sample code to show that... def handle_change_in_text_field(sen,sel,data) puts "The text field now holds "+data+" in it's 'text' property" end @user_input=FXTextField.new(parent_container,50) @user_input.text="Please put your name here" @user_input.connect(SEL_COMMAND,method(:handle_change_in_text_field)) -Richard ----- Original Message ----- From: "Nigel Wilkinson" To: "ruby-talk ML" Cc: "Lyle Johnson" ; Sent: Sunday, June 06, 2004 5:47 AM Subject: Re: Elementary FXDialogBox query > > --On Sunday, June 06, 2004 03:51:52 +0900 Lyle Johnson > wrote: > > > > > On Jun 5, 2004, at 12:41 PM, Nigel Wilkinson wrote: > > > >> I'm trying to use a dialog box in FXRuby. > > > > > > > > Umm, no. You don't call execute() on the dialog box while you're still > > constructing it. Try something like this instead: > > > > class AddItemDialog < FXDialogBox > > # Add an accessor so we can get to the text field later > > attr_accessor :textField > > > > def initialize(owner) > > ... as before, but... > > @textField = FXTextField.new(...) > > end > > def create > > ... as before ... > > end > > end > > > > and then invoke it like this: > > > > theDialog = AddItemDialog.new(someWindow) > > if theDialog.execute != 0 > > puts theDialog.textField > > end > > > > Hope this helps, > > > > Lyle > > > > Thanks, I've now got it working. Out of curiosity what class does > theDialog.textField return as I have had to use theDialog.textField.to_s to > use it as a string. > > Cheers > Nigel >