KXL_GetButton
Author: kacchan

Prev Top Next

Name
KXL_GetButton
Synopsis

    KXL_Button -- Get of the position and button number of a mouse cursor is carried out.

Description

    Uint16 KXL_GetButton(Uint16 *left, Uint16 *top);

Arguments

left | Left position of a mouse cursor.
top | Top position of a mouse cursor.

Return Value

    Button number.

Exsample

    #include <KXL.h>

    int main(void)
    {
      Bool flag = False;
      Uint16 left = 0;
      Uint16 top = 0;
      Uint16 no = 0;
      Uint8 buff[64];

      KXL_CreateWindow(100, 100, "kxl.org",
    		   KXL_EVENT_EXPOSURE_MASK |
                       KXL_EVENT_BUTTON_PRESS_MASK |
    		   KXL_EVENT_KEY_PRESS_MASK);

      while (flag == False) {
        while (KXL_CheckEvents() == False);
        switch (KXL_GetEvents()) {
        case KXL_EVENT_BUTTON_PRESS:
          no = KXL_GetButton(&left, &top);
          break;
        case KXL_EVENT_KEY_PRESS:
          flag = True;
          break;
        }
        KXL_ClearFrameImm(0, 0, 100, 100);
        sprintf(buff, "x:%4d", left);
        KXL_PutText(8, 20, buff);
        sprintf(buff, "y:%4d", top);
        KXL_PutText(8, 40, buff);
        sprintf(buff, "b:%4d", no);
        KXL_PutText(8, 60, buff);
        KXL_UpDateImm(0, 0, 100, 100);
      }
      KXL_DeleteWindow();
      return 0;
    }