| 1 | <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=euc-jp"> |
| 5 | <meta name="GENERATOR" content="emacs"> |
| 6 | <meta name="Author" content="kacchan"> |
| 7 | <title>KXL_GetButton</title> |
| 8 | </head> |
| 9 | <body text="#000000" bgcolor="#f0f0dc" link="#3366FF" vlink="#3366FF" alink="#FF0000"> |
| 10 | |
| 11 | <a href="./kxlgetkey.html">Prev</a> |
| 12 | <a href="./KXL.html">Top</a> |
| 13 | <a href="./kxlinitsound.html">Next</a> |
| 14 | <hr> |
| 15 | |
| 16 | <b>Name</b><br><br> |
| 17 | <font size=+2>KXL_GetButton</font><br><br> |
| 18 | |
| 19 | <b>Synopsis</b><br> |
| 20 | <pre>KXL_Button -- Get of the position and button number of a mouse cursor is carried out. |
| 21 | </pre><br> |
| 22 | |
| 23 | <b>Description</b><br> |
| 24 | <pre>Uint16 KXL_GetButton(Uint16 *left, Uint16 *top);</pre><br> |
| 25 | |
| 26 | <b>Arguments</b><br><br> |
| 27 | <table border="1"> |
| 28 | <tr><td>left</td><td>Left position of a mouse cursor.</td></tr> |
| 29 | <tr><td>top</td><td>Top position of a mouse cursor.</td></tr> |
| 30 | </table> |
| 31 | <br><br> |
| 32 | |
| 33 | <b>Return Value</b><br> |
| 34 | <pre> |
| 35 | Button number. |
| 36 | </pre> |
| 37 | <br> |
| 38 | |
| 39 | <b>Exsample</b><br> |
| 40 | <pre> |
| 41 | #include <KXL.h> |
| 42 | |
| 43 | int main(void) |
| 44 | { |
| 45 | Bool flag = False; |
| 46 | <b>Uint16 left = 0; |
| 47 | Uint16 top = 0; |
| 48 | Uint16 no = 0;</b> |
| 49 | Uint8 buff[64]; |
| 50 | |
| 51 | KXL_CreateWindow(100, 100, "kxl.org", |
| 52 | KXL_EVENT_EXPOSURE_MASK | |
| 53 | KXL_EVENT_BUTTON_PRESS_MASK | |
| 54 | KXL_EVENT_KEY_PRESS_MASK); |
| 55 | |
| 56 | while (flag == False) { |
| 57 | while (KXL_CheckEvents() == False); |
| 58 | switch (KXL_GetEvents()) { |
| 59 | case KXL_EVENT_BUTTON_PRESS: |
| 60 | <b>no = KXL_GetButton(&left, &top);</b> |
| 61 | break; |
| 62 | case KXL_EVENT_KEY_PRESS: |
| 63 | flag = True; |
| 64 | break; |
| 65 | } |
| 66 | KXL_ClearFrameImm(0, 0, 100, 100); |
| 67 | sprintf(buff, "x:%4d", left); |
| 68 | KXL_PutText(8, 20, buff); |
| 69 | sprintf(buff, "y:%4d", top); |
| 70 | KXL_PutText(8, 40, buff); |
| 71 | sprintf(buff, "b:%4d", no); |
| 72 | KXL_PutText(8, 60, buff); |
| 73 | KXL_UpDateImm(0, 0, 100, 100); |
| 74 | } |
| 75 | KXL_DeleteWindow(); |
| 76 | return 0; |
| 77 | } |
| 78 | </pre> |
| 79 | |
| 80 | |
| 81 | </body> |
| 82 | </html> |