From: Matthew Miller Date: 2002-06-11T12:39:21+09:00 Subject: FXRuby simple FXTextField question Hello, I've been learning to use FXRuby and it seems to be a to generate GUI apps. I'm having a small problem with an example I'm working on. What I want is a FXTextField that when I hit its contents are then displayed in another textfield. The first part is easy using the TEXTFIELD_ENTER_ONLY flag on the first text field. The trouble that I'm having is when is pressed the text is only displayed in the second textfield for a short time and the field then blanks itself. Below is the relevent snippit of code that I'm using. I have Ruby 1.6.7, FXRuby 1.0.10, and fox 1.0.11 installed. Also, the inputs.rb example supplied with FXRuby doesn't work correctly; you only see the output text of the command when you left-click and drag the mouse over the output window. I hope that someone can help me get over this hump! TIA, Matthew class LunchWindow < FXMainWindow def initialize(app) # Initialize base class super(app, "Lunch Counter", nil, nil, DECOR_ALL, 20, 20, 700, 460) @ssnValue = FXDataTarget.new("") FXLabel.new(nextFrame, "&SSN", nil, LAYOUT_CENTER_Y|LAYOUT_CENTER_X|JUSTIFY_LEFT|LAYOUT_FILL_ROW) @ssnInput = FXTextField.new(nextFrame, 13, @ssnValue, FXDataTarget::ID_VALUE, LAYOUT_CENTER_Y|LAYOUT_CENTER_X|FRAME_SUNKEN|FRAME_THICK| LAYOUT_FILL_ROW|TEXTFIELD_ENTER_ONLY) # call onSsnInput when is pressed. @ssnInput.connect(SEL_COMMAND, method(:onSsnInput)) FXLabel.new(nextFrame, "Entered SSN", nil, LAYOUT_CENTER_Y|LAYOUT_CENTER_X|JUSTIFY_LEFT|LAYOUT_FILL_ROW) # Test field to send output to. @echoValue = FXDataTarget.new(""); @echoField = FXTextField.new(nextFrame, 13, @echoValue, FXDataTarget::ID_VALUE, LAYOUT_CENTER_Y|LAYOUT_CENTER_X|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW) end # SSN input field callback. def onSsnInput( sender, sel, ptr ) @echoField.text = @ssnInput.text return 1 end