Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DODEFAULT with parameters
Message
De
01/08/2001 08:05:04
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
31/07/2001 18:04:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00538014
Message ID:
00538219
Vues:
18
Please note that not all methods need parameters, and not all methods need a return value. I just meant to point out this general rule: that IF a method returns a value, inheritance can be broken, not only by forgetting DoDefault(), but also by forgetting to return the correct value.

Hilmar.

>OK I tried that but no joy. Here is the code currently in the Keypress event
>
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>LOCAL lnresult
>lnresult = DODEFAULT(nKeyCode, nShiftAltCtrl)
>gcLastName = This.Value
>REQUERY("ChildList")
>ThisForm.Refresh()
>return(.t.)
>
>If I give the txtbox a control source ( a variable or a table field) it just
>puts one letter up which it overwrites ( in the case of a table field it displays the field and next to it on the left the changing letter). If I remove
>the control source it seems to work normally but the gcLastName assigned from
>this.value remains empty.
>>Two rules should be kept in mind with DoDefault():
>>
>>1) Parameters, if any, need to be passed. You obviously respected this one.
>>
>>2) Return values, if any, should be passed. Perhaps the problem is here.
>>
>>Like this:
>>
>>
>>local lxReturnValue
>>lxReturnValue = DoDefault(parameter1, parameter2)
>>(custom processing goes here)
>>return lxReturnValue
>>
>>
>>>This is a dumb one but it is bugging me.
>>>
>>>Several methods in the default classes (which I have subclassed) use predefined methods that receive parameters. For example most Error methods receive nError, cMessage, nLine & the Keypress event gets nKeyCode, nShiftAltCtrl. I like to add capability to these methods and am having trouble calling the default code.
>>>
>>>In Error's case I have used DODEFAULT(nError,cMessage,nLine) to allow those errors I don't trap to be processed normally. But nothing seems to happen using this syntax. I have had to find some code from another component and paste it in instead of the dodefault.
>>>
>>>In Keypress again I added DODEFAULT(nKeyCode, nShiftAltCtrl). This caused the object to only be one character long and the value to contain only the last character typed. Again I programmed around it with custom code all the way.
>>>
>>>Obviously, I would prefer not to custom code everything if I can help it. It is ineffient and prone to unforseen errors.
>>>
>>>Anyone got some ideas on this obviously dumb question
>>>
>>>Thanks in advance
>>>
>>>Terry
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform