Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Addobject.method....
Message
From
11/09/1999 17:07:01
Frank Cavone
Monetary Management of Ny, Inc.
Albany, New York, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Addobject.method....
Miscellaneous
Thread ID:
00263708
Message ID:
00263708
Views:
51
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
Map
View

Click here to load this message in the networking platform