Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing parameters to a function
Message
De
05/12/2008 15:06:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01365569
Message ID:
01365738
Vues:
28
>>
>>Your method looks like:
>>
>>procedure OpenForm( m.tcClassName, m.tcClasslib, m.tuParm1, m.tuParm2, m.tuParm3 )
>>local lnParameters, objForm
>>lnParameters = pcount()
>>do case
>>  case m.lnParameters = 0
>>    objForm = NEWOBJECT( m.tcClassName, m.tcClassLib)
>>  case m.lnParameters = 1
>>    objForm = NEWOBJECT( m.tcClassName, m.tcClassLib, '', m.tuParm1)
>>  case m.lnParameters = 2
>>    objForm = NEWOBJECT( m.tcClassName, m.tcClassLib, '', m.tuParm1, m.tuParm2)
>>  case m.lnParameters = 3
>>    objForm = NEWOBJECT( m.tcClassName, m.tcClassLib, '', m.tuParm1, m.tuParm2, m.tuParm3 )
>>endcase
>>
>>Where is the problem?
>>
>>Cetin
>
>There is absolutely no problem with your code - this is pretty much what I thought too. But I was concerned that this was not the most, how do I put it, "professional" approach. And since you recommend it (and I have the highest regard for your technical expertise), this approach is good now. Although I will try the parameter object also recommended in this thread.
>
>Thank you very much.

Dmitry,
I understand your concern but that is professional (for example you may think of it as C methods with the same name but different number of parameters, each would be a different "signature").
Object parameter (and I am one of those who advocate object parameter usage) is not appropriate for this case IMHO. For example you would then need all of your forms invoked this way have an lparameters line even if they don't have anything to do with parameters.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform