" The only question I have is to find out if there's an
easier way of doing this rather than attaching the code to the RightClick method of every object on the form."
This isn't something that's solved in VFP 8 or 9. I think it's purely a matter of good class design. If the user is using Base classes, then that's a no no but the solution would be to:
Change the Parent class of each object to say THISFORM.RightClick() .
Then change the RightClick of the Parent form class to call the RightClick menu in question.
HOWEVER, more on this post is noted when the user says "these commands need THISFORM in them which is only allowed in a method."
Well, for one, THISFORM can't be used in a menu anyways. The menu runs outside of the form anyways so instead the solution would be to:
PRIVATE poForm
poForm = THISFORM
DO xxx.MPR
which might look like:
DEFINE POPUP SHORTCUT SHORTCUT FROM MROW(),MCOL() RELATIVE
DEFINE BAR 1 OF SHORTCUT PROMPT poForm.Caption +" Options"
etc etc
This works in all recent versions of VFP , including 6.0.
FoxBlog
easier way of doing this rather than attaching the code to the RightClick method of every object on the form."
This isn't something that's solved in VFP 8 or 9. I think it's purely a matter of good class design. If the user is using Base classes, then that's a no no but the solution would be to:
Change the Parent class of each object to say THISFORM.RightClick() .
Then change the RightClick of the Parent form class to call the RightClick menu in question.
HOWEVER, more on this post is noted when the user says "these commands need THISFORM in them which is only allowed in a method."
Well, for one, THISFORM can't be used in a menu anyways. The menu runs outside of the form anyways so instead the solution would be to:
PRIVATE poForm
poForm = THISFORM
DO xxx.MPR
which might look like:
DEFINE POPUP SHORTCUT SHORTCUT FROM MROW(),MCOL() RELATIVE
DEFINE BAR 1 OF SHORTCUT PROMPT poForm.Caption +" Options"
etc etc
This works in all recent versions of VFP , including 6.0.
FoxBlog
Comments