 | | WideStudio/MWT Class Reference
| |
Class Name
WSDkeyboard
Specification of methods
WSGIappKeyboard method
- Form
- WSDkeyboard* WSGIappKeyboard()
- Function
- Returns the global instance of the class: WSDkeyboard.
- Description
-
- Parameters
- None.
- Return value
- Returns the global instance.
- Notice
- This method is a global function.
Do not delete the return value.
It is an invalid instance which is created by WSDkeyboard().
- Samples
-
WSDkeyboard* keyboard = WSGIappKeyboard();
//get the key code.
long keycode = keyboard->getKey();
//get the input string.
WSCstring str = keyboard->getText();
//get the kind of the key.
WSCbool cursor = keyboard->isCursorKey();
WSCbool funckey = keyboard->isFuncKey();
//get the status of the modifier key.
WSCbool shift = keyboard->withShift();
WSCbool ctrl = keyboard->withCntl();
WSCbool alt = keyboard->withAlt();
WSCbool lock = keyboard->withLock();
getText method
- Form
- char* getText()
- Function
- Returns the pressed key by the string.
- Description
-
- Parameters
- None.
- Return value
- Returns the string.
- Notice
- Do not delete the return value.
You can use use this method only
on the event:WSEV_KEY_PRESS fired.
- Samples
- Refer to WSGIappKeyboard().
setText method
- Form
- void setText(char*)
- Function
- Replaces the input string.
- Description
-
- Parameters
-
(in)char* str | String after replaced |
(in)long encoding | Encoding of the string |
Default encoding is WS_EN_DEFAULT.
Refer to WSCstring(char*,long) about the available encoding.
- Return value
- None.
- Notice
- Use setKey() to replace key code also.
- Samples
-
WSDkeyboard* keyboard = WSGIappKeyboard();
//get the input string.
WSCstring str = keyboard->getText();
//replace the input string.
if (!strcmp("a",(char*)str){
keyboard->setText("A");
}
getKey method
- Form
- long getKey()
- Function
- Returns the pressed key.
- Description
-
- Parameters
- None.
- Return value
- Return the key.
- Notice
- See the file which defined the key: include/WSkeysym.h
- Samples
- Refer to WSGIappKeyboard().
setKey method
- Form
- void setKey(long key)
- Function
- Replaces the key code.
- Description
-
- Parameters
-
(in)long key | a key code after replaced |
- Return value
- None.
- Notice
- See the file which defined the key: include/WSkeysym.h
- Samples
-
WSDkeyboard* keyboard = WSGIappKeyboard();
//get the key code.
long key = keyboard->getKey();
//replace the key code.
if (key == WSK_a){
keyboard->setKey(WSK_A);
}
withShift method
- Form
- WSCbool withShift()
- Function
- Examines whether the shift key is pressed at the same time.
- Description
-
- Parameters
- None.
- Return value
- Returns True if pressed; returns False if not.
- Notice
-
- Samples
- Refer to WSGIappKeyboard().
withLock method
- Form
- WSCbool withLock()
- Function
- Examines whether the CapsLock key is pressed at the same time.
- Description
-
- Parameters
- None.
- Return value
- Returns True if pressed; returns False if not.
- Notice
-
- Samples
- Refer to WSGIappKeyboard().
withCntl method
- Form
- WSCbool withCntl()
- Function
- Examines whether the control key is pressed at the same time.
- Description
-
- Parameters
- None.
- Return value
- Returns True if pressed; returns False if not.
- Notice
-
- Samples
- Refer to WSGIappKeyboard().
withAlt method
- Form
- WSCbool withAlt()
- Function
- Examines whether the alt key is pressed at the same time.
- Description
-
- Parameters
- None.
- Return value
- Returns True if pressed; returns False if not.
- Notice
-
- Samples
- Refer to WSGIappKeyboard().
isCursorKey method
- Form
- WSCbool isCursorKey()
- Function
- Examines whether it is the cursor key.
- Description
-
- Parameters
- None.
- Return value
- Returns True if pressed; returns False if not.
- Notice
- There are the following the cursor keys:
Up, Left, Down, Right, PageUp, PageDown, Begin, End, Next, Home.
- Samples
- Refer to WSGIappKeyboard().
isFuncKey method
- Form
- WSCbool isFuncKey()
- Function
- Examines whether it is the function key.
- Description
-
- Parameters
- None.
- Return value
- Returns True if pressed; returns False if not.
- Notice
- There are the following the cursor keys:
F1, F2, ..., F12.
- Samples
- Refer to WSGIappKeyboard().
Document Release 3.90 For use with WideStudio/MWT Release 3.90, Summer 2005 WideStudio/MWT Home | Up to Copyright(C) WideStudio/MWT Development Team, 1999-2005 | | Last modified: June 25, 2005 | |