General information
Category:
Forms & Form designer
Title:
Addobject.method....
i was able to use jims suggestion - see below - now my question is in regards to using the same class defininiton for any number of the same type of objects, but be able to change the click event or any other event for that matter in that class definition for their particular need. for example if i want the click event for textbox1 to release the form or i want the click event for textbox2 to make another object visible, depeneding on which was clicked. fist i would have to determine which text box was clicked and then act upon that, ie if a then b else c. or do you have to have a separate class definition for each?
to anyone working on a saturday
in the load event of a form i am able to add objects to the form using thisform.addobject method as follows:
thisform.addobject('testbox','textbox')
thisform.testbox.visible = .T.
thisform.testbox.left = 228
thisform.testbox.top = 340
this allows me to put, in this case the textbox on the form, but
how can i make it functional, in other works have mehtod processing available too, ie click event, key press event,
valid event, etc.
i tried to use define class within the load event method but that is not allowed.
help!
thanks
fc
Frank,
You must define the class before you try to use it. You can design a textbox class visually in teh class designer or in
a prg is code. Once you have designed the class you can;
SET CLASSLIB TO MyClass.vcx
or
SET PROCEDURE TO MyClass.prg
and then;
Thisform.AddObject("Text1","MyTextBoxClass")
I would also suggest moving the addobject call to the Form's Init as it fires after the Data environment is established
and the other controls have been created.
JimB
Jim's Web Site
Technical Advisor UT
Microsoft MVP
"Meessa got no boom boom", Jar Jar Binks.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only