Trapping Toolbar Commands

Most of the toolbar commands perform editing operations (like the clipboard operations, undo, redo, etc.) that are best handled internally by the XTEXT control without bother the application. But the following five toolbar commands involve I/O operations which the application might want to intercept and handle in a custom manner:

Toolbar Command

Fkey Equivalent

Help

F1

Open

F2 *

Save

F3

Print

F4

Search

F5

 

* F2 by itself does not invoke the Open command, but clicking on the Open toolbar icon is handled (for the purpose of intercepting the command and returning an exitcode) as equivalent to F2. The other F keys (F1, F3, F4, F5, F6) invoke the corresponding action regardless of whether the toolbar icon is present.

To intercept any of the above toolbar commands and return them to the application as exitcodes, set the TXF_FKEY flag, and also set the corresponding bits in the TXC.FMAPAPP field and clear them from the TXC.FMAPCTL field. For example, if display the Save icon on the toolbar and want to trap it in your application (rather than letting the control handle the command itself), then you would set &h0004 (tgurd bit, corresponding to F3) in TXC.FMAPAPP and clear the same bit from TXC.FMAPCTL. The user's click on the icon would then generate an exitcode -3.