Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine of a method contains code.
Message
De
24/10/1999 14:25:44
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00279928
Message ID:
00280619
Vues:
20
>>In one of my apps, I use right-click menus a lot. I have a form-level right-click menu that I want to appear if the user right-clicks on any control on the form that does not have its own right-click menu.
>>
>>What I am doing now is to have the right-click method of each of my base controls check to see if its parent has a rightclick method, and if that method contains code, it executes that method; if not it goes up one in the containership heirarchy and tests again, etc up to the top level container.
>>
>>I use pemstatus(oParent, 'RightClick', 0) - this checks if the propery or method has changed from its default. For a method, this returns TRUE if the method has code. The problem is that this only works if an EXE has compiled with debugging turned on -i.e. the source code is contained in the EXE. But I really don't want to ship my app with the code included if I can help it, both from a size and security point of view.
>>
>>Does anyone have any ideas on this subject?
>>
>>Larry
>
>In inheritance if you call a method that is empty, it will by default call the parent's method.
>
>You could try using ReadMethod to test for code.
>
>HTH

ReadMethod has the same flaw - if there is no code in the .EXE (debug turned off), it always returns the null string.

Inheritance does NOT seem to work for EVENTS such as right click. Put a WAIT WINDOW in the rightclick method of a form. Put a control on the form. Right-click the control - the form-level rightclick method does not get invoked.

Now, if I put a custom method SHowMenu() method in every control, have the right_click method (event) invoke the ShowMenu() method, then that should work its way up the heirarchy. However, one can't create a custom method on the pages of page frames or text boxes in grid columns, so there is no way of handling this.

That's the nice thing about the method I was using - it works its way up the heirarchy looking for a method with code - it does not depend on each level in the heirarchy having a method. If a particular level has no method, it just carries on up to the parent.

Larry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform