Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defining Classes
Message
From
23/04/2002 11:47:45
 
 
To
23/04/2002 11:34:21
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00648203
Message ID:
00648215
Views:
19
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
Previous
Reply
Map
View

Click here to load this message in the networking platform