Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Place of DODEFAULT()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01605192
Message ID:
01605197
Vues:
49
>>I have a control class bases on the container. The hierarchy of the classes is as following:
>>Container - VFP class
>>MyBaseClass - based on VFP Container
>>MySpecificClass - based on MyBaseClass
>>
>>Now I need to change the size of the MySpecificClass (bases on some semaphore flag) so that this MySpecificClass is wider and the textbox inside of this class is wider. So I need to add the code to the INIT method of MySpecificClass, something like the following:
>>
>>
>>if file("my_semaphore")
>>   this.width = this.width + 50
>>   this.txt_box.width = this.txt_box.width + 50
>>endif
>>
>>
>>But of course I want the code in the MyBaseClass INIT to be fired. For example, would it correct the following?
>>
>>
>>dodefault()
>>if file("my_semaphore")
>>   this.width = this.width + 50
>>   this.txt_box.width = this.txt_box.width + 50
>>endif
>>
>>
>>And should dodefault() be before or after my "specific" code? Or it does not matter at all?
>>
>>TIA
>
>It depends what you want :-)
>Most of the cases it didn't matter where it is placed,
>but IF you want to cancel the INIT and have logic for this in your base class method you should carefully decide where to place this method:
>Sometimes you need this:
>
>lbReturn = DODEFAULT()
>** "specific" code and maybe change lbReturn
>RETURN lbReturn
>
>
>
>other time you can do this:
>
>** "specific" code
>RETURN DODEFAULT()
>
Interesting. I have never seen the code "RETURN DODEFAULT()" but it makes sense. My base class has RETURN .F. in its INIT (in case of cancel).

So now I am wondering, if I were to have the code as I put in my initial example (DODEFAULT() first, and then the custom code) and the code in the DODEFAULT() return .F., would the control still initialize?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform