Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting the Default property of a command button...
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00037354
Message ID:
00037355
Views:
33
>I'm having a slight problem. In one of my fields on a form,
>I have the following code in the SetFocus method:
>
>thisform.cmdSetName.Default=.T.
>
>Shouldn't that make the command button the default? When you click
>on the field, you can see the command button flicker, but it doesn't
>retain the dark border around it indicating that it's the default
>button (and it's proven when nothing happens when you hit enter except
>that focus leaves the input field and moves to the next object).
>
>I also have a similar line of code in the LostFocus method of that
>same field. It is:
>
>thisform.cmdOK.Default=.T.
>
>Same behavior as above. Am I doing something wrong?

I don't understand why you are doing this, :)
but probably you should handle Enter key pressing in textbox KeyPress event:

if nkeyCode = 13
this.parent.myCmdbutton.Click()
NODEFAULT
endif
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform