Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 Tags
Subject: RE: Egg or bird: what's first?
Thread ID: 143433 Message ID: 143436 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Tuesday, August 28, 2007 8:22:20 PM         
   


> Colleagues,
>
> everybody knows (I hope) that, taking the Q. in subject literally, egg (fish, amphybians, then reptiles) was first and bird (dinosaurs) appeared only afterwards. (Just to lighten up the mood :).
>
> Now, when you instantiated some class, and you have some code for some event in that object, and the base class has different code for that same event - which code is being executed first (bar NODEFAULT/DODEFAULT())?
>
> For instance: you have a class MyCommButton, and some (quasi-)generic code in its Click event procedure; you instantiate this class - drag/drop into some form, - name it cmdWhatever, and add your specific code into that same Click event procedure. You run your program, bring up this form on display, click on that cmdWhatever...
>
> What code is being executed first: generic (in the class) or specific (added by you)?
>
> TIA!
>
> Regards,
>
> Ilya

Ilya,

Barring any DODEFAULT() the code that you apply in the instance on your form will be performed but your base code will not. Try this.

Make a base command button class and add the following to your base command button's .Click()
WAIT WINDOW [BaseButton.Click()]

Now, drop an instance of that base button on a new form and run it. It will properly display the message. Now, on the form, go into the ThisForm.BaseButton1.Click() and add the following:
WAIT WINDOW [ThisForm.BaseButton1.Click()]

run the form again and you will only get one message - the second one.

Add a DODEFAULT() to ThisForm.BaseButton1.Click() before the WAIT WINDOW command and you will get two messages - the base class message first and the form's instance next. Move the DODEFAULT to after the WAIT WINDOW and the order of appearance will be reversed.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

Egg or bird: what's first? Posted by Ilya Rabyy @ 8/28/2007 7:50:35 PM
RE: Egg or bird: what's first? Posted by Ken Murphy @ 8/28/2007 8:22:20 PM
RE: Egg or bird: what's first? Posted by Ilya Rabyy @ 8/28/2007 8:32:37 PM
RE: Egg or bird: what's first? Posted by Ken Murphy @ 8/28/2007 8:36:23 PM
RE: Egg or bird: what's first? Posted by Borislav Borissov @ 8/28/2007 11:42:40 PM
RE: Egg or bird: what's first? Posted by Cetin Basoz @ 8/28/2007 11:46:26 PM
RE: Egg or bird: what's first? Posted by Ken Murphy @ 8/28/2007 11:56:24 PM
RE: Egg or bird: what's first? Posted by Borislav Borissov @ 8/28/2007 11:56:41 PM
RE: Egg or bird: what's first? Posted by Ken Murphy @ 8/29/2007 12:03:44 AM
RE: Egg or bird: what's first? Posted by Cetin Basoz @ 8/29/2007 12:07:00 AM
RE: Egg or bird: what's first? Posted by Cetin Basoz @ 8/28/2007 11:31:35 PM