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
16/04/1998 14:35:58
 
 
To
16/04/1998 14:33:51
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00092543
Message ID:
00092639
Views:
37
>>>>>>>>>>>>>>>>>How can I set the property of a button from a procedure?
>>>>>>>>>>>>>>>>>From a menu option and in a procedure file, I want to enable
>>>>>>>>>>>>>>>>>a button on my form. any ideas?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>As long as you keep reference to a form, you can use this reference:
>>>>>>>>>>>>>>>>oApp.frm1.cmdButton.enabled=.t.
>>>>>>>>>>>>>>>---
>>>>>>>>>>>>>>>OK - we said you could createobject for a class and reference a method
>>>>>>>>>>>>>>>from that class, but we did not say anything about creatobject with a FORM
>>>>>>>>>>>>>>>and reference objects on that from? can I :
>>>>>>>>>>>>>>>omy_form = createobject("myform") and then
>>>>>>>>>>>>>>>omy_form.cmdbutton.enabled - .t. ????
>>>>>>>>>>>>>>>can I do this? and it this the way it is done?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Yes, you should link form object to variable or much better to app object property:
>>>>>>>>>>>>>>oApp.Frm1=createobject("class1")
>>>>>>>>>>>>>>or
>>>>>>>>>>>>>>DO FORM frm1 name oApp.frm1 linked
>>>>>>>>>>>>>---
>>>>>>>>>>>>>I tried to o.my_form=createobject("my_from") and I got an
>>>>>>>>>>>>>error message saying: class definition MY_FORM not found?
>>>>>>>>>>>>>can you help with this? MY_FORM is my main FORM.
>>>>>>>>>>>>
>>>>>>>>>>>>You had it:
>>>>>>>>>>>>DO FORM frm1 name oApp.frm1 linked
>>>>>>>>>>>---
>>>>>>>>>>>I guess I have missed a step.
>>>>>>>>>>>I want to reference a button on a form, but my form is not a class.
>>>>>>>>>>>could you please me a smal sample of code to do this?
>>>>>>>>>>
>>>>>>>>>>Rob, i just gave you the sample. Did you read replies? Repeating:
>>>>>>>>>>DO FORM frm1 name oApp.frm1 linked
>>>>>>>>>>oApp.frm1.cmdButton.Enabled=.t.
>>>>>>>>>---
>>>>>>>>>Here is the code I am using and it is not working:
>>>>>>>>>DO FORM updatcal oApp.updatcal linked
>>>>>>>>>oApp.updatcal.cmdenterquery.Enabled=.t.
>>>>>>>>>is this all the code?
>>>>>>>>
>>>>>>>>Where is name? Should i repeat one more time?
>>>>>>>---
>>>>>>>OK - I put name in..
>>>>>>>DO FORM updatcal name oApp.updatcal linked
>>>>>>> oApp.updatcal.cmdenterquery.Enabled=.t.
>>>>>>>Now I get an error message saying: property UPDATCAL is not found.
>>>>>>>UPDATCAL is the name of my FORM.
>>>>>>
>>>>>>That's good enough, but also you should have oApp object with property Updatcal
>>>>>---
>>>>>Please hang in there - we are almost home -
>>>>>I am not sure how to make a oApp object with property Updatcal?
>>>>>Remeber, all i want to do is call mybutton.enabled = .t. from a file.
>>>>
>>>>I will remember.
>>>>oApp=createobject("clApp")
>>>>
>>>>Define Class clApp as custom
>>>>updatcal=.NULL.
>>>>Enddefine
>>>---
>>>In my main.prg, I have:
>>>oform=createobject("myform")
>>>and
>>>Define Class myform as custom
>>> updatcal=.NULL.
>>>Enddefine
>>>
>>>From a menu option in a procedure file,
>>>I have:
>>>DO FORM updatcal name oform.updatcal linked
>>> oform.updatcal.cmdenterquery.Enabled=.t.
>>>I am getting an error message saying, Unknown member CMDENTERQUERY...
>>
>>CMDENTERQUERY supposed to be button name in your own form and I guess that you should know better what names are you using in your application.
>---
>CMDENTERQUERY is the button, it is not being found for some reason. do you know
>why? I am not getting to my form (updatcal)...

Actually, I know why, but I will not say for some reason. I see that you ask people to join to this thread, and i believe it's a good idea.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform