Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Prevent control from getting focus due to rightclick
Message
From
06/05/2002 17:00:21
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00653252
Message ID:
00653269
Views:
22
This message has been marked as a message which has helped to the initial question of the thread.
Armin,

You probably will have to set the focus back to the control that had focus previously. You can add a property to the form (call it oCurrentControl, for example). Or, better yet, add it to your form class. In your custom control classes, in the gotfocus() method, you could put something like:
&& you should check that thisform.oCurrentControl exists first...
thisform.oCurrentControl = this
Then in rightClick() method of the commandbutton:
if vartype(thisform.oCurrentControl) = "O"  && also, check out PEMStatus(), getPEMStatus(), 
                                            && you may want to call it to make sure the setfocus()
                                            && method really exists...although it shouldn't be
                                            && necessary if the only place that sets oCurrentControl to
                                            && an object is an object that has setfocus()
    thisform.oCurrentControl.setfocus()
endif
This is just the basic concept; you will have to work with a little to make it bulletproof for all situations.

Let me know if you need more info...


>Hi,
>
>does anybody know, how I could prevent a control (for example a commandbutton) from getting focus, when the user right clicks on it?
>
>The problem is here, that the When event fires before any mouse event is fired and a NODEFAULT in the MouseDown is too late. So the only chance seems to be, to check in the When event if the right mouse button is pressed. But how can I find that out? Or does anyone see another alternative?
>
>TIA,
>Armin
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform