Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Defining Classes
Message
De
23/04/2002 11:47:45
 
 
À
23/04/2002 11:34:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00648203
Message ID:
00648215
Vues:
20
Ger,

I don't know if you are using addobject or createobject, but you can set the properties after you create the object. It is not a good idea to set properties within the class definition itself to variables that may (or may not) exist when the object is created.

Another option is to define an init() method, and pass in parameters when you create the object. Yet another option is to define a method, such as setControlSource(), which you would call to set these properties.
oCombo1 = createobject("cmdMyComboBox1")
oCombo1.rowsource = source1
oCombo1.controlSource = controlSrc1
oCombo2 = createobject("cmdMyComboBox1")
oCombo2.rowsource = source2
oCombo2.controlSource = controlSrc2

>DEFINE CLASS cmdMyComboBox1 AS ComboBox && Create Combo box
>       Style = 2
>       FontSize = 8
>       RowSourceType = 1
>       ToolTipText = mytable.messagefield
>       * RowSource = source1   && this will cause you grief
>       * ControlSource = Controlsrc
>       * Value = fldvalue
>       Visible =.T.
>ENDDEFINE
>
>When I call this class a second time but with different values for the ControlSource and RowSource it still retains the values of the original.
>
>Anyone any ideas of how to pass in new values to these properties.
Steve Gibson
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform