Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
 Tags
Subject: RE: Finding previus SetFocus
Thread ID: 50570 Message ID: 50670 # Views: 1 # Ratings: 0
Version: Visual FoxPro 8 Category: Other
Date: Saturday, September 04, 2004 12:19:22 PM         
   


> Hi Costantinos
>
> > Is any command showing what was the previous SetFocus on a Form ??????????????????
>
> No, you have to store the information yourself if you need to know what had focus BEFORE the current control.
>
> The simplest method is to add a property to your form class (oLastControl = NULL ) and then either use sub-classing, or use BINDEVENT(), to link the LOSTFOCUS() of each control to a method that updates the property. That way when any control loses focus it immediately sets itself as the last control to have focus...
>
> Regards
> Andy Kramek
> Microsoft MVP (Visual FoxPro)
> Akron, OH, USA

Hi,
For 100% control of what you are doing I agree with Andy. Sub-class your objects such as command buttons,
testboxes, etc. Add generic code in the objects gotfocus event to update something with the objects name. In my
case I use a public memvar to hold the last focus name of the object.
I say update with the objects name as I am guessing you want a way to set the focus back to the previous object
if required. You will need it's name to do this. Amd by the way, a memory variable containing this:
lcgoThere="Thisform.Mytextbox1.Setfocus"
Can be used like: &lcgoThere
to set the focus back if you know the objects name. I use this approach in POS systems where I am using a
virtual keyboard and want to set the focus back to the input location when the user touches a key on the
virtual keyboard. There could be several textboxes, so I need to know the one that currently has the focus
to update values into from the virtual keyboard.
Pete from the Great White North. (Only in Canada, ay.) Over and Out ...


ENTIRE THREAD

Finding previus SetFocus Posted by Costas Loizou @ 9/3/2004 9:43:41 AM
RE: Finding previus SetFocus Posted by Lucy Alice Pilanga @ 9/3/2004 11:05:27 AM
RE: Finding previus SetFocus Posted by Costas Loizou @ 9/3/2004 2:42:08 PM
RE: Finding previus SetFocus Posted by Ken Blum @ 9/3/2004 3:53:32 PM
RE: Finding previus SetFocus Posted by Craig Moore @ 9/3/2004 4:18:52 PM
RE: Finding previus SetFocus Posted by Andy Kramek @ 9/3/2004 4:54:10 PM
RE: Finding previus SetFocus Posted by Pete Sass @ 9/4/2004 12:19:22 PM
RE: Finding previus SetFocus Posted by Mz @ 9/6/2004 11:29:10 AM
THANK YOU ALL - RE: Finding previus SetFocus Posted by Costas Loizou @ 9/6/2004 12:23:44 PM