Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Dec 18, 2018 2:22 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Returning Focus to Last Control
PostPosted: Sun Feb 10, 2013 11:20 am 
Offline
User avatar

Joined: Wed Feb 01, 2012 3:06 pm
Posts: 68
Is there any easy or convenient way to restore focus to the control that had it last ?

The scenario is an input screen with some text fields and a few push buttons. The operator is tabbing through in normal tab index order and then presses one of the push buttons.

Is there some way to have the push button perform it's function and then, when appropriate, return focus to the control that had focus when the user pressed the push button ?

Ron Bower
Ellicott City, MD

_________________
Ron Bower
Ellicott City, MD


Top
 Profile  
Reply with quote  
 Post subject: Re: Returning Focus to Last Control
PostPosted: Sun Feb 10, 2013 11:56 am 
Offline

Joined: Fri Sep 30, 2005 8:53 am
Posts: 1002
RonBower wrote:
Is there any easy or convenient way to restore focus to the control that had it last ?

The scenario is an input screen with some text fields and a few push buttons. The operator is tabbing through in normal tab index order and then presses one of the push buttons.

Is there some way to have the push button perform it's function and then, when appropriate, return focus to the control that had focus when the user pressed the push button ?

Ron Bower
Ellicott City, MD


Create a property on the Window:

LastFocus as RectControl


In the "GotFocus" event of the relevant controls but NOT the button put:
LastFocus = Me

In the Button "Action" event put

' Your action code
LastFocus.SetFocus


Top
 Profile  
Reply with quote  
 Post subject: Re: Returning Focus to Last Control
PostPosted: Sun Feb 10, 2013 6:46 pm 
Offline
User avatar

Joined: Wed Feb 01, 2012 3:06 pm
Posts: 68
Brilliant !!!

Works great - Thanks a bunch.

Ron Bower
Ellicott City, MD

_________________
Ron Bower
Ellicott City, MD


Top
 Profile  
Reply with quote  
 Post subject: Re: Returning Focus to Last Control
PostPosted: Mon Feb 11, 2013 3:09 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Or save some code and put in the pushbutton MouseDown event

LastFocus = self.Focus

Then when the button action event is done

LastFocus.SetFocus


Top
 Profile  
Reply with quote  
 Post subject: Re: Returning Focus to Last Control
PostPosted: Mon Feb 11, 2013 10:52 am 
Offline
User avatar

Joined: Wed Feb 01, 2012 3:06 pm
Posts: 68
That works very well, also !

Thanks for both responses...

So much to learn, so little time.

Ron Bower

_________________
Ron Bower
Ellicott City, MD


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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