Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object losing focus
Message
From
01/05/2001 16:39:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/05/2001 16:27:05
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00502203
Message ID:
00502239
Views:
27
>>>In order to keep the tabbing on a form to go from one textbox to another, rather than the page tab, I'm using the KeyPress event of the last textbox to capture the TAB key and set the focus to the first textbox. The focus hits the correct box, but only briefly and then continues onto the second textbox in the TabOrder. It effectively is skipping the textbox I'm directing the focus to. I ran a trace on the code, but it's hard to know exactly what is going on as the pageframe refreshes (on it's own) right after the SetFocus is called. Is there another way to do this? There isn't a TabStop property for the page or I might have tried to set that to false. Thanks!
>>>
>>>Regards, Renoir
>>
>>Renoir,
>>Did you include a 'NODEFAULT' there before setfocus ?
>>Cetin
>
>Cetin,
>
>I did now -- and it works... I looked it up and it seems to tell Foxpro not to run the default code for that method. How does putting that before the SetFocus call allow the focus to go to the textbox instead of the page? Thanks!
>
>Renoir

Renoir,
Hard to explain in plain language for me :) It's effective for built-in methods.
You can understand how it works with these :
*Keypress of a texbox
lparameters ....
if nKeyCode = asc('l')
 nodefault && Behave as if it's never pressed
 keyboard 'z' && and user goes nuts trying to input hello:)
* Try uncommenting this
* dodefault(same params here in lparameters ...)
endif

* A lostfocus code
if !lastkey()=13 && Assuming only keying and ignoring mouse check here
 nodefault
 this.setfocus()
endif

* This wouldn't work
if !lastkey()=13 && Assuming only keying and ignoring mouse check here
 this.setfocus()
endif

* Because w/o nodefault implicit dodefault() for built-in methods
BTW I oversee that you were using pageframes. IMHO with pgf this.ActivePage = lnPagenumber works more reliably then this.Pages(n).Setfocus and refresh.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform