Announcement

Collapse
No announcement yet.

Make unusable a button.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Make unusable a button.

    Hi,

    I'd like to make an unusable button depending of the mode.

    For example I have 3 user buttons (Button 1, Button 2, Button 3):

    Mode 1: I would like to make visible and usable my 3 buttons.
    Mode 2: I can't use Button 2, I would like to make Button 2 visible but unusable, and make it as grised button.

    Maybe I can use img_darken / img_lighten, but I haven't find an example of how to use it.
    And is it possible to use this function with an user button?

    Best regards,
    Toragan

  • #2
    Hi Toragan,

    To disable the touch on the iUserbutton, you can use this code:
    Code:
    img_SetAttributes(hndl,  iUserbutton1, I_TOUCH_DISABLE);
    and to enable it again:
    Code:
    img_ClearAttributes(hndl,  iUserbutton1, I_TOUCH_DISABLE);
    If you want to change the index of the image on the Userbutton, change its value:
    Code:
    img_SetWord(hndl, iUserbutton1, IMAGE_INDEX, value);
    And to show the image:
    Code:
    img_Show(hndl,iUserbutton1);
    You can also check the application note for the User Button: ViSi-Genie User Button

    I have also attached a simple project for your reference:


    Best Regards,
    Kevin
    Attached Files

    Comment


    • #3
      Hi Kevin,

      Thanks it's what i'm looking for.

      Best regards,
      Toragan

      Comment


      • John Kevin
        John Kevin commented
        Editing a comment
        No problem. I am glad it helps.
    Working...
    X