One Way..(I Like the visual)
Give your button a name then on the OnValidate of the checkbox
OnValidate()
IF MyBoolean
THEN
CurrForm.MyButtonName.VISIBLE(FALSE)
ELSE
CurrForm.MyButtonName.VISIBLE(TRUE);
Not only is it technically disabled, it's not even there
I wouldn't personally go for the invisible button appraoch as you may end up with ugly spaces where buttons should be depending on where it is placed, then again I wouldn't go for the non editable button either, I'm just a purist I suppose
But not use only the OnValidate() Trigger. Than, whats happens, when user scroll the mouse wheel or go through the recs ;-)
So, user OnAfterGetRecord or currRecord (Listforms)
I've done this customization (onafter solution) a little time ago...remember to valorize editability in onopenform(), too...
or whe you open the form the button will be editable anyway, because you didn't enter the OnAftergetCurrRecord trigger :-$ :-$
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
Comments
Give your button a name then on the OnValidate of the checkbox
OnValidate()
IF MyBoolean
THEN
CurrForm.MyButtonName.VISIBLE(FALSE)
ELSE
CurrForm.MyButtonName.VISIBLE(TRUE);
Not only is it technically disabled, it's not even there
http://www.BiloBeauty.com
http://www.autismspeaks.org
Than in OnAftergetCurrRecord on Form type following
CurrForm.YourButtonName.Enable := not YourCheckBoxValue;
or use visible insteda of enable
regards
I wouldn't personally go for the invisible button appraoch as you may end up with ugly spaces where buttons should be depending on where it is placed, then again I wouldn't go for the non editable button either, I'm just a purist I suppose
Also, could simplify the code slightly:
www.NextEqualZero.com
A technical eye on Dynamics NAV
Still great to see how many ways one thing can be accomplished!
http://www.BiloBeauty.com
http://www.autismspeaks.org
So, user OnAfterGetRecord or currRecord (Listforms)
Well they all can't be winner's
i guess you'd have to put the code in several places to cover all bases. :sick:
http://www.BiloBeauty.com
http://www.autismspeaks.org
OnPush()
TESTFIELD(MyBooleanField,FALSE);
http://www.BiloBeauty.com
http://www.autismspeaks.org
And which version you use JAYESH :?:
or whe you open the form the button will be editable anyway, because you didn't enter the OnAftergetCurrRecord trigger :-$ :-$
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog