f



Help with an editable text field in GUI

Hi everybody!

I've developed a graphical user interface that contains a couple of editable text fields, and both of them have defined the same callback routine which is only executed in order to check the introduced parameters. When the user introduces incorrect parameters, an error dialog box is displayed with an error message. In my case, when the incorrect parameter corresponds to first editable text field, the error dialog box is correctly displayed, but the (mouse) cursor has move to the second editable text field and I'd like to force it for not moving till the first parameter is correct. Any idea?.

Thanks a lot. Best regards, Iv?n.
0
cerralla (13)
3/27/2009 8:57:01 AM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
582 Views

Similar Articles

[PageSpeed] 3

"Ivan " <cerralla@yahoo.es> wrote in message <gqi4ct$2ns$1@fred.mathworks.com>...
> Hi everybody!
> 
> I've developed a graphical user interface that contains a couple of editable text fields, and both of them have defined the same callback routine which is only executed in order to check the introduced parameters. When the user introduces incorrect parameters, an error dialog box is displayed with an error message. In my case, when the incorrect parameter corresponds to first editable text field, the error dialog box is correctly displayed, but the (mouse) cursor has move to the second editable text field and I'd like to force it for not moving till the first parameter is correct. Any idea?.
> 
> Thanks a lot. Best regards, Iv?n.


The uicontrol function has an undocumented (well, undocumented only in the help section - it is documented in the doc) feature that if you give it the uicontrol's handle it will move the focus to that control. So, in your callback, simply move the focus back to the offending uicontrol:

uicontrol(hOffendingControl);

Yair Altman
http://UndocumentedMatlab.com 
 
0
altmanyDEL (1141)
3/27/2009 12:03:01 PM
Reply: