Want to Disbaled button when Checkbox value is True

JAYESHJAYESH Member Posts: 290
Hi experts,

I want to make a button disbaled when on same form Checkbox is tick on. and enabled when on same form checkbox is tick OFF

What i have to do for that?

Thanx .
JAYESH PATEL

Comments

  • SavatageSavatage Member Posts: 7,142
    edited 2008-03-12
    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
  • garakgarak Member Posts: 3,263
    First the button mus have an name in property name.
    Than in OnAftergetCurrRecord on Form type following

    CurrForm.YourButtonName.Enable := not YourCheckBoxValue;


    or use visible insteda of enable

    regards
    Do you make it right, it works too!
  • garakgarak Member Posts: 3,263
    Savatage, u was a few seconds faster O:)
    Do you make it right, it works too!
  • Revolution1210Revolution1210 Member Posts: 161
    Savatage wrote:
    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 :D

    Also, could simplify the code slightly:
    CurrForm.MyButtonName.VISIBLE(MyBoolean)
    
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • SavatageSavatage Member Posts: 7,142
    It's a personal choice - that's what my users like. They don't want to even see the option if it's not available to use.

    Still great to see how many ways one thing can be accomplished!
  • garakgarak Member Posts: 3,263
    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)
    Do you make it right, it works too!
  • SavatageSavatage Member Posts: 7,142
    Just realized that :oops:

    Well they all can't be winner's :mrgreen:

    i guess you'd have to put the code in several places to cover all bases. :sick:
  • garakgarak Member Posts: 3,263
    :lol:
    Do you make it right, it works too!
  • SavatageSavatage Member Posts: 7,142
    Here's another way add the code to the button

    OnPush()
    TESTFIELD(MyBooleanField,FALSE);
  • JAYESHJAYESH Member Posts: 290
    Thanx Alll :D
    JAYESH PATEL
  • garakgarak Member Posts: 3,263
    Sava: I've the same idea, but my users scream, if they see messages like this and they think and say -> we've found an bug :roll:

    And which version you use JAYESH :?:
    Do you make it right, it works too!
  • BeliasBelias Member Posts: 2,998
    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
Sign In or Register to comment.