Enabling/Disabling a command button on a form

Hi, I was trying to do something I just discovered I don’t know how to do. [:I] I have a form and a subform, quite a standard issue. On the main form I ha ve a command button. I would like to enable or disable the abovesaid command button according to the content of the subform lines. To better explain: et’s suppose that the subform line Rec contains a boolean field “Enable Button”. I want that when the cursor lays on a line with “Enable Button”=TRUE, the button on the main form is enabled, when the cursor lays on a line with “Enable Button”=FALSE, the button is disabled. Is that possible? Thanks Anna

If I should do this, I would cheat with the GUI-guideline and place my buttoms on the subform. It’s quite difficult to update the mainform from a subform.

I think this is the old story of using the OnTimer trigger on the main form. Anybody got a better idea? Sunny, if the button is supposed to do something with the main form, you have just pushed the problem one level deeper [:D]

 Here's a solution using the OnTimer trigger on the main form Step 1: Add a button to the form and name it (e.g. MagicButton). Step 2: Add a function (e.g. EnableButton) to the subform. Remember to name the subform as well (e.g. SubForm). EnableButton() : Boolean EXIT("Enable Button");´ Step 3: Set the TimerInterval on the mainform (e.g. 100 = 0,1 sec). Step 4: On the OnTimer Trigger on the main form enter code as follows: Toggle Button enabled: CurrForm.SubForm.ENABLED(CurrForm.SubForm.FORM.EnableButton); or Toggle Button visible CurrForm.SubForm.VISIBLE(CurrForm.SubForm.FORM.EnableButton); 


Originally posted by Steffen Voel
Here’s a solution using the OnTimer trigger on the main form … Toggle Button enabled: CurrForm.SubForm.ENABLED(CurrForm.SubForm.FORM.EnableButton);

I guess you meant CurrForm.MagicButton.ENABLED(CurrForm.SubForm.FORM.EnableButton); but I got it and it works. Thank you very much. [:)] Anna