Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with KeyPress
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00452358
Message ID:
00452364
Views:
16
In order fot the Valid of the textbox to fire, an attempt has to be made to make it lose focus. The On Key Label is not making that happen.

A better way (IMO) to design this would be to have a SaveMethod at the form level. That method could validate each control. It could also SetFocus to the Save button to make the textbox's value get written to the controlsource.

F8 could call the SaveMethod and so could the Click method of the Save button.

HTH.

>Steps to you see the problem:
>
>1 - Create a Class (Form)
>2 - Put 2 buttons: Save and Cancel
>3 - In ThisForm.KeyPress: (Class)
> If nKeyCode = -7 && F8
> ThisForm.Save.Valid
> EndIf
>4 - In ThisForm.Save.Valid (Class)
> MessageBox("Class - ThisForm.Save.Valid OK")
>5 - Save the class...
>
>6 - Create a form based in the class.
>7 - Put a TextBox.
>8 - In ThisForm.TextBox.Valid (Form)
> MessageBox("Form - ThisForm.TextBox.Valid - OK")
>9 - Save the file.
>
>10 - Do form Sample1
>11 - Click (mouse) on the button Save... Will appear 2 messages.
>12 - But if you press the F8 key - Will appear just 1 message... The ThisForm.TextBox.Valid is not execute.
>
>How can I solve this problem?
>
>Sorry about my english but I don't have time to pratice! :)
>
>[]s
>
>Rodolfo Duarte
>rodolfo@computar.com.br
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform