1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
9<title>KBDSetKeyCallback</title>
10</head>
11
12<body>
13
14<h1>KBDSetKeyCallback</h1>
15
16<h2>Syntax</h2>
17<dl><dd><pre class="construction">
18#include &lt;revolution/kbd.h&gt;
19
20KBDKeyCallbackF KBDSetKeyCallback (KBDKeyCallbackF fn);
21</pre></dd></dl>
22
23<h2>Arguments</h2>
24<TABLE class="arguments" border="1" >
25  <tr>
26<TH>fn</TH>
27<TD>Pointer to a function to callback when a key is pressed or released on the keyboard.</TD>
28  </tr>
29</TABLE>
30
31<h2>Return Values</h2>
32<TABLE class="arguments" border="1" >
33  <tr>
34<TH>KBDKeyCallbackF</TH>
35<TD>A pointer to the previous keyboard key callback.</TD>
36  </tr>
37</TABLE>
38
39<h2>Description</h2>
40<p>This call registers a function that the KBD library will call whenever a keyboard key is pressed or released. The function pointer typedef <code>KBDKeyCallbackF</code> is defined as shown below.</p>
41
42<dl><dd><pre class="construction">
43typedef struct _KBDKeyEvent {
44  KBDChannel channel;
45  KBDHIDCode  hid;        // USB HID code
46  KBDKeyMode  mode;       // for up/down/etc
47  KBDModState modState;   // modifier state
48  KBDUnicode  unicode;    // Unicode, if any
49} KBDKeyEvent;
50
51typedef void (*KBDKeyCallbackF) (KBDKeyEvent*);
52</pre></dd></dl>
53
54<p>To call the <SPAN class="argument">fn</SPAN> function, use a pointer to the <code>KBDKeyEvent</code> structure. The <code>KBDKeyEvent</code> structure contains the keyboard channel that generated the event, the USB HID code associated with the key, the type of key event, the current keyboard modifier state, and the translated Unicode associated with the key.</p>
55<p>For more detail about the data within this structure, refer to <a href="KBDKeyEvent.html"><code>KBDKeyEvent</code></a>.</p>
56
57<h2>See Also</h2>
58<P class="reference">
59<a href="list.html">Keyboard Functions</a>,
60<a href="KBDKeyEvent.html">KBDKeyEvent</a>
61</p>
62
63<h2>Revision History</h2>
64<P>
652007/03/19 Initial version.<br>
66</p>
67
68<hr><p>CONFIDENTIAL</p></body>
69</HTML>