The QKEY class gives your external component access to keyboard messages and some keyboard checking functions. It refers to two kinds of key, a VCHAR and a PCHAR. A VCHAR is a virtual key code for special keys such as the PageUp key. PCHAR refers to printable characters.
Keyboard messages WM_KEYDOWN and WM_KEYUP pass a pointer to a qkey object.
An enum defining some virtual keyboard values.
vcF1
The F1 key on the keyboard
vcUp
The up arrow key on the keyboard
vcDown
The down arrow key on the keyboard
vcLeft
The left arrow key on the keyboard
vcRight
The right arrow key on the keyboard
vcPup
The page up key on the keyboard
vcPdown
The page down key on the keyboard
vcPleft
The page left key on the keyboard
vcPright
The page right key on the keyboard
vcHome
The home key on the keyboard
vcEnd
The end key on the keyboard
vcTab
The tab key on the keyboard
vcReturn
The return key on the keyboard
vcEnter
The enter key on the keyboard
vcBack
The backspace key on the keyboard
vcClear
The clear key on the keyboard
vcCancel
The escape key on the keyboard
vcDel
The forward delete key on the keyboard
vcIns
The insert key on the keyboard
qkey::qkey( LPARAM pKeyValue ) |
---|
The constructor for the external keyboard class. After construction, the class can be used to interrogate the keyboard message.
pKeyValue - This is the keyboard scan value passed in LPARAM on a WM_KEYDOWN, WM_KEYUP message.
qkey::qkey( pchar pPchar, qbool pShift, qbool pOption, qbool pControl ) |
---|
Creates a qkey object from the printable character and key states passed.
pPchar - The printable character to be added into the new qkey.
pShift - The state of the shift key for the new qkey object.
pOption - The state of the option key for the new qkey object.
pControl - The state of the control key for the new qkey object.
return - Returns a new qkey object.
See also qkey::getPChar()
qkey::qkey( vchar pVchar, qbool pShift, qbool pOption, qbool pControl ) |
---|
Creates a qkey object from the virtual key code and key states passed.
pVchar - The virtual keyboard value to be added into the new qkey.
pShift - The state of the shift key for the new qkey object.
pOption - The state of the option key for the new qkey object.
pControl - The state of the control key for the new qkey object.
return - Returns a new qkey object.
qkey::qkey( ) |
---|
Creates a qkey object with only the modifier states ( SHIFT, CONTROL and OPTION ) set.
return - Returns a new qkey object.
pchar qkey::getPChar() |
---|
Returns the printable character from the key message.
returns - Returns the character.
vchar qkey::getVChar() |
---|
Returns the virtual key code from the key message.
returns - Returns the key code.
qbool qkey::isAlt() |
---|
Returns the state of the ALT key for this keyboard message.
returns - Returns qtrue if the ALT key is down.
qbool qkey::isControl() |
---|
Returns the state of the CONTROL key for this keyboard message.
returns - Returns qtrue if the CONTROL key is down.
qbool qkey::isShift() |
---|
Returns the state of the SHIFT key for this keyboard message.
returns - Returns qtrue if the SHIFT key is down.
qbool qkey::operator ! ( ) |
---|
Tests if the qkey object is invalid.
return - qtrue if the qkey object is invalid and qfalse if the object is valid.
qbool qkey::operator != ( const qkey& pTestKey ) |
---|
Compares the key message stored in this qkey object with the key message passed in.
pTestKey - The qkey object to compare against.
return - qtrue if the qkey key messages are not the same.
qbool qkey::operator == ( const qkey& pTestKey ) |
---|
Compares the key message stored in this qkey object with the key message passed in.
pTestKey - The qkey object to compare against.
return - qtrue if the qkey key messages match and qfalse if the objects are different.
void qkey::uppc() |
---|
Uppercases the printable character stored in the qkey object.
See also qkey::getPChar()
qbool isShift() |
---|
Returns the current state of the SHIFT key.
returns - Returns qtrue if the SHIFT key is down and qfalse if up.
qbool isAlt() |
---|
Returns the current state of the ALT key.
returns - Returns qtrue if the ALT key is down and qfalse if up.
Example: