Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I set the property of a button from a procedure?
Message
From
17/04/1998 14:47:28
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00092543
Message ID:
00092996
Views:
38
>>>I try to do everything as "OOP-as-possible" but to do it that way wouldn't you have to save every form you create via the form-designer as a class in order to utilize CreateObject()? Either that or do it all through code including adding of all the objects and PEMs?
>>
>>The way to handle non-class forms is actually the same as for class forms:
>>DO FORM frm1 NAME oApp.frm1 LINKED
>>and form reference saved in application object property (also you can use collection member here).
>
>OK, I read all the thread, and I am interested in figuring out the way you are doing this. I put the following code in my startup.prg:
>oApp = CreateObject("clApp")
>
>Define class clApp as Custom
>procedure init
>   * The Main (test) menu has a bar with a command call:
>   * Do form test1 name oApp.frmTest1 linked
>   * Then, I have a button on test1 that calls form test2:
>   * Do form test2 name oApp.frmTest2 linked
>   do Main.mpr
>   read events
>endproc
>Enddefine
>I understand the principle here in that you are instanciating an application object that will be available throughout the app session. However, I have tested several different ways here, and get error message that says "Object oApp not found". I put the code in the init because of error message that said it wasn't being called from a procedure if placed after the enddefine statement.

Why did you put READ EVENTS inside class definition?
I use following structure:
***Main.Prg
set procedure to sysproc
do header && some settings here
oApp=createobject("clApp")
do form topform name oApp.topform && start top-level form
read events
do footer && some cleaning here
return

define class clApp as custom
topform=.NULL.
enddefine
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform