Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Modifying form objects from a .prg file
Message
From
11/01/1999 09:00:21
 
 
To
08/01/1999 18:02:35
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00174042
Message ID:
00174619
Views:
32
>>>Hi, all.
>>>
>>>I have a form (frmA) with a command button (cmdB). This command button, depending on different factors, will run a program (myPrg.prg). I would like this prg to be able to modify objects on the form (frmA). Examles of this would be enabling/disabling different textboxes. I'm a little confused on the syntax to do this. I've tried various things and none have worked.
>>>
>>>Has anybody done this and can you tell me how you did it?
>>>
>>>tia,
>>>Marc Mandel
>>
>>The simplest way is to pass form object to prg:
>>***button.click event
>>DO MyPrg With Thisform
>>*** MyPrg.Prg
>>LParameter oForm
>>oForm.Textbox1.Enabled=.F.
>
>Thanks, Ed. As usual, you are right on the money... I want to use this idea in two different places. The first is a 'plain' form and the second is in a page of a pageframe.
>
>I can get it to work within the plain form, but I'm having problems within the page of the pageframe. Do I still use 'thisform' in 'Do MyPrg With Thisform'?
>
>For example, form frmMyForm contains pageframe pgfMyFrame which contains a page pagMyPage. If I understand this correctly, isn't oForm really frmMyForm? Wouldn't the syntax of MyPrg.Prg be as follows:
>
>LParamater oForm
>oForm.pgfMyFrame.pagMyPage.Textbox1.enabled = .f.
>
>It must not be, because I get an error 'unknown member pagMyPage'.
>
>As always,
>TIA,
>Marc Mandel

oForm is really the form, so you probably should check carefully proper page name. However, it's not a requirement to pass Thisform. You may, e.g. call
***button.click event
DO MyPrg With This.Parent && assuming that button is member of page
*** MyPrg.Prg
LParameter oParent
oParent.Textbox1.Enabled=.F. && assuming that textbox is part of the same page
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform