No announcement yet.

Enabling / Disabling keyboard buttons

  • Filter
  • Time
  • Show
Clear All
new posts

  • Enabling / Disabling keyboard buttons

    I want to be able to control what buttons on a keyboard are shown. I thought I could use img_Disable(), but all that does is disable the keys from being touched. Setting the DARKEN attribute did nothing either .What am I missing here?[HTML] if(1 /*!SerialF0*/) // do this always while testing
    img_Disable(hndl, iKeyboard1+1);
    img_SetAttributes(hndl, iKeyboard1+1, I_DARKEN);
    img_Disable(hndl, iKeyboard1+2);
    img_Disable(hndl, iKeyboard1+3);

    img_Show(hndl, iKeyboard1);
    for (i := iKeyboard1+1; i

  • #2

    Are you trying to permanently remove the key from the keyboard (which would be better done by removing the key fron the keyboard editor), or temporarily(which will probably be a lot harder)


    • #3

      Temporary. Keys shown are to be based on user options. I guess the other way would be to regroup the keys into separate keyboards and show only those that are needed, but is does lead to a clunky looking display.


      • #4

        img_SetWord(hndl, 16,IMAGE_INDEX, 1); // select the 'down' state as it already is darker
        gfx_BevelShadow(1) ; // and make it even darker
        img_Darken(hndl, 16) ; // darken 'Q' key
        img_Show(hndl, 16) ; // and show it that way
        gfx_BevelShadow(3) ; // back to default, so we don't upset anyone else
        img_SetAttributes(hndl, 16, I_TOUCH_DISABLE) ; // stop it being detected
        That would disable the 'Q' key in the keyboard demo, you should be able to use something similar. Of course you will need to do the reverse to renable the key

        Remember that if the user has a 'shift/shift lock' key then when they press that the entire keyboard gets redrawn. If you need to handle that then you need to place a copy of the 'show disabled key' part of the code just after the call to setkeystate in the refreshstate function in


        • #5


          I have a keyboard that I disable when a counter reaches a certain number, and then I would like to enable just the Enter Key, which on my keyboard has a value of 13. How can I do this? I have tried to use

          img_SetAttributes(hndl, 13, ~I_TOUCH_DISABLE) ;

          I don't get any errors but it doesn't work either. What is the converse of I_TOUCH_DISABLE. I tried I_TOUCH_ENABLE but that didn't work, can you help.

          Thank you,



          • #6

            I presume (hope), you are disabling all the individual keys, so all you need to do is enable the key index for the Enter key.

            The index of each key is a number starting in the top left corner, so the index of the Enter key, if I counted them right is 41.


            img_Enable(hndl, ikeyboard1+41);

            Should be about right

            I_TOUCH_DISABLE / ENABLE just changes the ability of an image control entry to detect touch, by default videos are disabled, each part of a keyboard is a video so they all need enabling for touch


            • #7

              Yes, I am using a for loop to disable all the keys and then selecting the Enter key to be active so they can exit the screen, thank you for your help, your suggestion worked perfectly.