Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optional number of parameters and protected procedure
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01182425
Message ID:
01182616
Views:
32
>>Hi everybody,
>>
>>I have a method in the class with optional number of parameters which calls a protected procedure of the same class. I'm passing parameters as is from one procedure to another. I guess the only way to know from this protected procedure how many parameters did I pass originally is to actually pass the number of parameters as a parameter.
>>
>>Do you see any other way here?
>>
>>Thanks in advance.
>
>by using the PCOUNT(), you could do something with a case statement... hoping nothing excessive like 10+ parameters...
>
>
>lParameters Parm1, Parm2, Parm3, Parm4
>
>do case
>case pcount() = 1
>  lAnswer = dodefault( Parm1 )
>
>case pcount() = 2
>  lAnswer = dodefault( Parm1, Parm2 )
>
>etc...
>
>endcase
>
>*/ then do whatever with the default lAnswer upon return
>
>
>
>This way, the ROOT function doesn't have to change based on a false 4 parameters coming in, if the current function was only passed 2.

The trick was that the public DoForm method calls Protected _DoForm method. So I can not use pcount it in and have to pass it from the public method as an additional parameter. That worked, but after reading all the responses I got I'm not so sure this technique is really good one.

Anyway, I may leave this as is for now, since I'm now facing more problems because I tried to combine two existing different frameworks into one.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform