Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Sep 23, 2017 11:37 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: SetFocus, Tab Order problem
PostPosted: Thu Apr 18, 2013 9:04 pm 
Offline
User avatar

Joined: Fri Oct 10, 2008 7:14 pm
Posts: 94
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
 Profile  
Reply with quote  
 Post subject: Re: SetFocus, Tab Order problem
PostPosted: Thu Apr 18, 2013 10:28 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
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
 Profile  
Reply with quote  
 Post subject: Re: SetFocus, Tab Order problem
PostPosted: Thu Apr 18, 2013 11:29 pm 
Offline
User avatar

Joined: Wed Sep 20, 2006 5:12 pm
Posts: 680
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
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group