Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
(VFP) Forms that much harder than (FPW) screens?
Message
From
27/02/2001 21:06:44
 
 
To
27/02/2001 13:56:20
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00480200
Message ID:
00480354
Views:
10
>IF INKEY() = 27
> wait window 'Esc key pressed'
>ELSE
> IF INKEY() = 13
> wait window 'Enter key pressed'
> =TableUpdate(.T.)
> ENDIF
>ENDIF
>

The terminating key has already been read when the VALID fires; you might want to look at the LASTKEY() value instead. Typically, Enter triggers the control set as Default, and Escape the one assigned Cancel.

You could trap the KeyPress event of the textbox control to react to the Enter or Escape; KeyPress receives the keycode for each keystroke other than Alt-key sequences or things like Tab. You can process all keystrokes in the Form's KeyPress event by setting the Form's KeyPreview to .T.

BTW, if you want to TABLEUPDATE() on Enter, you probably want to TABLEREVERT() on Escape.

It's definitely not harder, just different and generally allows much finer control and more consistent Windows behavior than FPW ever did. Take a look at some example code from the Files section or Samples that shipped with VFP to get a feel for how it works. You might try either reading the On-Line Help, or picking up a book like Whil Hentzen's "The Fundamentals" that cover the language as a whole; once you've started working in VFP, books like "Effective Techniques" by Booth and Sawyer and "KiloFox" by Akins, Kramer and Schummer will offer the theory and concrete methods for handling tasks with VFP. A little reading (the books will cost well under $100, even with shipping and handling) will go a long way towards helping you work in VFP.

>The above code is what I had for a long time (and forgot about it) in the Valid of the textbox. Ever since, I have never seen either wait window message (yes, I did press the Esc and Enter).
>
>Not only that, I am still having trouble getting ThisForm.List1.Refresh to work (ThisForm.Refresh does not even refresh the listbox). I did put it in the Requery, as someone suggested (and worked for him as he tested it). I just can not understand why all this trouble for me? I mean this form only has 1 textbox and 1 listbox, but it's that hard already!?!?!?
>
>I am a sitting duck right now, right after I finally make a big wave with my supervisor and co-worker. I have had this form for 2 weeks so far. Sorry, but I want to ask if anyone would like to take a look at this project for me and make some corrections. You can email directly to me or ask here...
>
>Chuck
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform