Using the mouse Foundation
The first step in porting existing Clipper programs to a 32bit operating system is integrating the mouse for program navigation. In Xbase++, all dialog functions and commands can be controlled using the mouse. This includes @...SAY...GET, MENU TO, Alert(), TBrowse(), and Memoedit(). To provide mouse support, the function SetMouse(.T.) needs to be inserted into the start routine of the program. If this is included, the function AppEvent() is used to retrieve events instead of the function Inkey(), which reads only keyboard input. Both functions return a numeric value corresponding to either the key code of a pressed key (Inkey()) or the identity of the last event that occurred (AppEvent()). With Clipper, Inkey() is the function generally used to retrieve keyboard input. This function only exists in Xbase++ for compatibility. Xbase++ replaces Inkey() with the function AppEvent() in order to read events from the event queue.
The return values of AppEvent() and Inkey() may be different when the same key is pressed because the DOS Inkey() code is not compatible with the AppEvent() code. For this reason, the transition to mouse support using SetMouse(.T.) also requires that calls to SetKey() be replaced by calls to the function SetAppEvent(). Code blocks that are associated to keys using SetKey() must be associated to the same key using SetAppEvent(). The #define constant used to identify keys is also different. For example:
The first line contains Clipper code. This call associates the function key F10 to a code block. This code also works correctly in Xbase++ as long as the mouse is not activated. After SetMouse(.T.) is called to activate the mouse, the code block {|| DoSomething() } will not be executed when the F10 key is pressed. To guarantee execution of the appropriate code block after the F10 key is pressed, the code block must be associated to the xbeK_F10 event code rather than the K_F10 key code using SetAppEvent().
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.