FXRuby - changing cursor position

I’m editing an input form in FXRuby and want to position the cursor to
the field in error, the one that is blank. How do I get the cursor to
position where I want it?

Here is my code snippet:

def testwidget

test(@@nametxt, "You must enter the name")

end

def test(widget, message)

    if widget.text == ""   

 	 FXMessageBox.information(self, MBOX_OK,
    		"Field in Error",message)     	

(This is where I want to put the code to position the cursor to the
field, in this case @@nametxt)
end
end

I’ve tried changing some of the attributes of FXTextField, but nothing
works.

TIA

John Reed

John Reed wrote:

I’m editing an input form in FXRuby and want to position the cursor to
the field in error, the one that is blank. How do I get the cursor to
position where I want it?

Use the FXWindow#setFocus() method, i.e.

widget.setFocus()

Hope this helps,

Lyle