Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question about methods
Message
 
 
To
30/07/1998 13:43:53
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00122766
Message ID:
00122770
Views:
18
>Hi All,
>
>I feel stupid asking this question, but I am just learning VFP. It seems that most methods for custom controls are stored in the class library file. However some samples which I have seen lately seem to handle some methods in a different way. Some of the methods for some specific controls are defined only after the control is placed on a form. This kind of method is apparently not part of the class definition. I am confused.
>
>When you modify a method of a control after it has been placed on a form, where is the code stored? What are the reasons why you would want to use this kind of a method rather than including the method in the class definition? With this approach, it almost seems like the form becomes very much like a class definition.
>
>Please help me understand.
>
>TIA

No problem. Let's say you create a custom command button and place some code in the click method of that code. We save the button in a class library and name it Button1.

You now drop that button on a form. Its name will be something like Button11. You can do one of 3 things:

1. You now can place additional code in the click method. The original code is still in the parent class (Button1), but this code now will not fire unless you include the command DeDefault somewhere in the click method of the button the form.

2. If you do not add code to the click method, you can still prevent default code from firing in the parent by issuing the Nodefault command in the click method().

3. If no code is in the click method, the code in the parent class (Button1) will fire.

DoDefault is only available in VFP5. If using VFP3, you have to use the command Button1::Click()
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform