[fxruby-users] Retriving FXTextField Data

Harold Worby H.Worby at kinsey.com
Mon Mar 28 00:24:30 EST 2005


I must be missing something very basic.
The following code displays a dialog with three text fields.
The fields are initalized with values from an FXTable object.
When I edit the data in the fields an click the Accept button I expected the
FXTextField.text property to contain the modyfied text. What I get is the
original unmodified text.

How do I reference the modifyed text?

Harold
----------------------------------------------------------------------------
------
def dlgNewTest(cell)
    dlg =
FXDialogBox.new(getApp(),"Destination",DECOR_TITLE|DECOR_BORDER,0,0,0,0)
    outter = FXVerticalFrame.new(dlg,LAYOUT_FILL_X|LAYOUT_FILL_Y)
    # Initalize Contents
    fields = FXVerticalFrame.new(outter,LAYOUT_FILL_X|LAYOUT_FILL_Y)
         txtName=FXTextField.new(fields ,20 , nil,TEXTFIELD_NORMAL)
	 txtName.text=@table.getItemText(cell.row,1)
         txtPath=FXTextField.new(fields ,66 , nil,TEXTFIELD_NORMAL)
	 txtPath.text=@table.getItemText(cell.row,2)
         txtSize=FXTextField.new(fields ,12 , nil,TEXTFIELD_NORMAL)
	 txtSize.text=@table.getItemText(cell.row,3)
    # Separator
    FXHorizontalSeparator.new(outter,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|SEPARA
TOR_GROOVE)
    # Bottom buttons
    buttons=FXHorizontalFrame.new(outter)
    # Accept
	FXButton.new(buttons, "&Accept", nil, dlg, FXDialogBox::ID_ACCEPT,
	 FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y){
		 print "Accept1 ",cell.row," ",txtName.text,"\n"
		 print "Accept2 ",cell.row," ",txtPath.text,"\n"
		 print "Accept3 ",cell.row," ",txtSize.text,"\n"
		 @table.setItemText(cell.row,1,txtName.text)
		 @table.setItemText(cell.row,2,txtPath.text)
		 @table.setItemText(cell.row,3,txtSize.text)
	    }
     # Cancel
	FXButton.new(buttons, "&Cancel", nil, dlg, FXDialogBox::ID_CANCEL,
	 FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
     # Delete
	FXButton.new(buttons, "&Delete", nil, dlg, FXDialogBox::ID_CANCEL,
	 FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
    dlg.create
    dlg.execute
end




More information about the fxruby-users mailing list