New topic: SetFocus, Tab Order problem
<http://forums.realsoftware.com/viewtopic.php?t=47640> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message plunkettphoto Post subject: SetFocus, Tab Order problemPosted: Thu Apr 18, 2013 9:04 pm Joined: Fri Oct 10, 2008 7:14 pm Posts: 79 if tfPassword.Text = tfPasswordVerify.Text then tfFirstName.SetFocus else MsgBox("Passwords do not match, reenter") tfPassword.SetFocus end This code is in the LostFocus event of tfPasswordVerify I have a simple method to test if 2 textfields match in a password test. tfPassword is tab order 2, tfPasswordVerify is tab order 3 and tfFirstName is tab order 4 when the fields match, everything is fine, no msgbox, and focus goes to tfFirstName. when the fields don't match, I get the msgbox but focus still goes to tfFirstName instead of going back to tfPassword What am I doing wrong. thanks bill Top timhare Post subject: Re: SetFocus, Tab Order problemPosted: Thu Apr 18, 2013 10:28 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 12237 Location: Portland, OR USA LostFocus is the wrong place to try to set focus. It gets called before the next field actually gets focus, so what's happening is tfPasswordVerify LostFocus tfPassword.SetFocus tfPassword gets focus tfPassword loses focus because... tfFirstName is given focus by the system As nice as it would be if you could direct traffic from LostFocus, it just doesn't work. Try trapping the tab key in the KeyDown event of each textfield and SetFocus there, before the system initiates focus going to the next control. Top jetpr Post subject: Re: SetFocus, Tab Order problemPosted: Thu Apr 18, 2013 11:29 pm Joined: Wed Sep 20, 2006 5:12 pm Posts: 643 Location: Puerto Rico tray FocusNext _________________ Thanks for any contribution and God blesses all (I start Using RS in 10/12/2010) Mac Mini with Lion v10.7.5 and Real Studio 2012r1 Pro And Windows 7 RS2012r1 Personal and Linux RS2012r1 Personal Register user my Hobbies R/C Turbines Jets Models Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
