eventData1和eventData2的意义是什么???
我是一个新手,请帮助在CVI中eventData1和eventData2在函数中代表了什么意义!!!
急!!!!! 不同的控件的这二个值好像有不同的意义,您可以设置断点,看不同的控件,它有不同的值,从而可以发现它不是统一的! Using Callback Functions to Respond to User Interface Events
Callback functions respond to all events generated by the User Interface Library. The C prototypes for the callback functions are in userint.h. You can assign callback functions to panels, menu bars, controls, or the main callback. When the user generates an event on a particular user interface object, the appropriate callback function executes. Idle events and end-task events are passed to the main callback function only. InstallMainCallback installs this main callback function.
LabWindows/CVI passes event information from the GUI to the callback functions. For example, callback functions receive the type of user interface event that occurred, such as EVENT_LEFT_CLICK, and some additional information concerning that event, such as the x- and y-coordinates of the mouse cursor when the click occurred. You are free to design your functions to use this information when responding to events. LabWindows/CVI also passes callback data to the callback function that you define. 这是CVI的帮助文档中提到的! CVI回调函数原形为:CVICALLBACK FunctionCallBack (int panel, int control, int event,void *callbackData, int eventData1, int eventData2)
其中,
panel指控件所在的面板(注意:Tab、Table等控件例外)的句柄;
control指控件句柄(ID);
event是指控件所具有的事件,各个不同类型的控件具有的事件不完全相同;
callbackData为指针型变量,在程序调用函数时可以传递某些特殊的变量;
eventdata1和eventdata2在具体应用中的表示意义不同:
1、在鼠标事件中(EVENT_LEFT_CLICK、EVENT_RIGHT_CLICK等),eventdata1和eventdata2表示鼠标按下时,相对于面板的x轴和y轴坐标。你可以在鼠标事件中通过这两个参数获取鼠标的位置;
2、在键盘事件中(EVENT_KEYPRESS),eventdata1表示键盘按键值和状态,eventdata2则是指向实际键值的指针;
3、在焦点事件中,eventdata1在获取焦点事件(EVENT_GOT_FOCUS)表示前一个具有焦点的控件ID号;在失去焦点事件(EVENT_LOST_FOCUS)表示下一个获得焦点的控件ID号,eventdata2无意义;
4、Timer控件事件中,eventdata1表示当前时间值的指针,eventdata2表示上次响应此消息到现在的时间间隔。 学习了 Lady GaGa
Michael
Jackson
vitas
Justin Bieber
Avril Lavigne
Westlife
Backstreet Boys
Linkin Park
Britney Spears
Eminem
Akon
Groove Coverage
Shakira
Mariah Carey
Taylor Swift
Black Eyed Peas
Katy Perry
Blue
Rihanna
Lenka
Sarah Connor
Madonna
Sarah Brightman
Celine Dion
Green Day
Usher
Alizee
owl city
Enya
Amy Diamond
Christina
Aguilera
Alicia Keys
Miley Cyrus
One Republic
Jennifer Lopez
2Pac
Maria Arredondo
Adam Lambert
U2
Timbaland
Norah Jones
50 Cent
Lene Marlin
学习了 受教了 版主讲的很详细啊,学到了
页:
[1]