|
发表于 2005-12-13 19:14:18
|
显示全部楼层
<H1>EVENT_KEYPRESS</H1>
< ><STRONG>Object Types:</STRONG> <a href="mk MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIOperating_Panels.htm" target="_blank" > anels</A>, <a href="mk MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVINumeric_Control_Overview.htm" target="_blank" >numerics</A>, <a href="mk MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIColor_Numeric_Control_Overview.htm" target="_blank" >color numerics</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVINumeric_Slide_Control_Overview.htm" target="_blank" >numeric slides</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIString_Control_Overview.htm" target="_blank" >strings</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIText_Box_Control_Overview.htm" target="_blank" >text boxes</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVICommand_Button_Control_Overview.htm" target="_blank" >command buttons</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIPicture_Button_Control_Overview.htm" target="_blank" >picture buttons</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIToggle_Button_Control_Overview.htm" target="_blank" >toggle buttons</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIText_Button_Control_Overview.htm" target="_blank" >text buttons</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIRadio_Button_Control_Overview.htm" target="_blank" >radio buttons</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVILED_Control_Overview.htm" target="_blank" >LEDs</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIBinary_Switch_Control_Overview.htm" target="_blank" >binary switches</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIRing_Control_Overview.htm" target="_blank" >rings</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIRing_Slide_Control_Overview.htm" target="_blank" >ring slides</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIPicture_Ring_Control_Overview.htm" target="_blank" >picture rings</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIList_Box_Control_Overview.htm" target="_blank" >list boxes</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIGraph_Control_Overview.htm" target="_blank" >graphs</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVICanvas_Control_Overview.htm" target="_blank" >canvases</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVITable_Control_Overview.htm" target="_blank" >tables</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviTree_Control_Overview.htm" target="_blank" >trees</A>, and <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviTab_Control_Overview.htm" target="_blank" >tabs</A>. </P>
< ><STRONG>Description:</STRONG> Keyboard events are sent to the <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVIUsing_Callback_Functions_to_Resp.htm" target="_blank" >callback function</A> associated with the control which has the input focus, and to the callback function associated with the control’s panel. If you <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CVISwallowing_Events.htm" target="_blank" >swallow</A> the event, LabWindows/CVI does not process the event any further. </P>
<P>If a user enters a dual-byte character in a control, two EVENT_KEYPRESS events are sent to the callback function. In order to process the character as a single event, you should ignore the first event. You can use <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviKeyPressEventIsLeadByte.htm" target="_blank" >KeyPressEventIsLeadByte</A> to determine when you receive the first event of a dual-byte character. When you receive the second event, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviKeyPressEventIsTrailByte.htm" target="_blank" >KeyPressEventIsTrailByte</A> returns TRUE. You can then use <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviGetKeyPressEventCharacter.htm" target="_blank" >GetKeyPressEventCharacter</A> to obtain the full dual-byte character. </P>
<P><STRONG>Event Data Parameters:</STRONG> </P>
<P>eventData1 = <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/CviEVENTKEYPRESS.htm#KeyCode" target="_blank" >Key code</A>.</P>
<P>eventData2 = Pointer to key code. Pass <STRONG>eventData2</STRONG> to the following functions: <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviKeyPressEventIsLeadByte.htm" target="_blank" >KeyPressEventIsLeadByte</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviKeyPressEventIsTrailByte.htm" target="_blank" >KeyPressEventIsTrailByte</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviGetKeyPressEventVirtualKey.htm" target="_blank" >GetKeyPressEventVirtualKey</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviGetKeyPressEventCharacter.htm" target="_blank" >GetKeyPressEventCharacter</A>, <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviGetKeyPressEventModifiers.htm" target="_blank" >GetKeyPressEventModifiers</A>, and <a href="mk:@MSITStore:d:\program%20files\national%20instruments\cvi80\bin\cvi.chm::/UIRef/cviSetKeyPressEventKey.htm" target="_blank" >SetKeyPressEventKey</A>. </P>
<H2>Key Codes</H2>
<P>Form key codes by a logical OR operation on values representing a modifier key and either an ASCII character or a virtual key.</P>
<P>A modifier key is a <Shift> key, <Alt> key, or menu modifier key (the <Ctrl> key). The following constants represent the modifier key.</P>
<P>VAL_SHIFT_MODIFIER = 0x010000<BR>VAL_UNDERLINE_MODIFIER = 0x020000<BR>VAL_MENUKEY_MODIFIER = 0x040000<BR>VAL_SHIFT_AND_MENUKEY = 0x050000<BR></P>
<P>ASCII characters can be represented by a literal character, for example, 'A' or 'D', or an ASCII value. There is no distinction between upper and lower case ASCII characters.</P>
<P>Virtual keys are non-ASCII keys represented by the following key codes:</P>
<P>VAL_FWD_DELETE_VKEY = 0x0100<BR>VAL_BACKSPACE_VKEY = 0x0200<BR>VAL_ESC_VKEY = 0x0300<BR>VAL_TAB_VKEY = 0x0400<BR>VAL_ENTER_VKEY = 0x0500<BR>VAL_UP_ARROW_VKEY = 0x0600<BR>VAL_DOWN_ARROW_VKEY = 0x0700<BR>VAL_LEFT_ARROW_VKEY = 0x0800<BR>VAL_RIGHT_ARROW_VKEY = 0x0900<BR>VAL_INSERT_VKEY = 0x0A00<BR>VAL_HOME_VKEY = 0x0B00<BR>VAL_END_VKEY = 0x0C00<BR>VAL_PAGE_UP_VKEY = 0x0D00<BR>VAL_PAGE_DOWN_VKEY = 0x0E00<BR>VAL_F1_VKEY = 0x0F00<BR>VAL_F2_VKEY = 0x1000<BR>VAL_F3_VKEY = 0x1100<BR>VAL_F4_VKEY = 0x1200<BR>VAL_F5_VKEY = 0x1300<BR>VAL_F6_VKEY = 0x1400<BR>VAL_F7_VKEY = 0x1500<BR>VAL_F8_VKEY = 0x1600<BR>VAL_F9_VKEY = 0x1700<BR>VAL_F10_VKEY = 0x1800<BR>VAL_F11_VKEY = 0x1900<BR>VAL_F12_VKEY = 0x1A00</P>
<P>ASCII cannot be used with a virtual key code. Virtual key codes can be used with or without a modifier. The shift and menu modifier keys can be used together. For example, the expression VAL_MENUKEY_MODIFIER | 'A' specifies <Ctrl-A>. Other valid key codes include the following: </P>
<P>VAL_TAB_VKEY<BR>VAL_SHIFT_MODIFIER | VAL_F5_VKEY</P>
<P>The result of the logical OR operation is a 4-byte integer consisting of three bit fields, 0x00MMVVAA, where</P>
<P>MM = the modifier key<BR>VV = the virtual key <BR>AA = the ASCII key</P> |
|