right-click_20context_20menu
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| right-click_20context_20menu [2018/03/31 13:19] – external edit 127.0.0.1 | right-click_20context_20menu [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| =====Right-click Context Menu===== | =====Right-click Context Menu===== | ||
| - | //by Richard Russell, March 2014//\\ \\ When the user right-clicks in a window a WM_CONTEXTMENU message is generated, which may be intercepted using **ON SYS** (so long as a ***SYS 1** command has been issued). On receipt of this message you should typically display a popup menu containing commands relevant to the context, for example if the user right-clicks in an editing pane it would often be appropriate to display the same menu as results from clicking on **Edit** in the menu bar. Typical code to achieve that would be as follows:\\ | + | //by Richard Russell, March 2014//\\ \\ When the user right-clicks in a window a WM_CONTEXTMENU message is generated, which may be intercepted using **ON SYS** (so long as a ***SYS 1** command has been issued). On receipt of this message you should typically display a popup menu containing commands relevant to the context, for example if the user right-clicks in an editing pane it would often be appropriate to display the same menu as results from clicking on **Edit** in the menu bar. Typical code to achieve that would be as follows: |
| + | |||
| + | <code bb4w> | ||
| X% = (lpar% << 16) >> 16 | X% = (lpar% << 16) >> 16 | ||
| Y% = lpar% >> 16 | Y% = lpar% >> 16 | ||
| IF wpar% = hEdit% THEN dummy% = FNtrackpopupmenu(EditMenu%, | IF wpar% = hEdit% THEN dummy% = FNtrackpopupmenu(EditMenu%, | ||
| - | Here **wpar%** and **lpar%** correspond to the **@wparam%** and **@lparam%** values from the original ON SYS interrupt (typically via an [[http:// | + | </ |
| + | |||
| + | Here **wpar%** and **lpar%** correspond to the **@wparam%** and **@lparam%** values from the original ON SYS interrupt (typically via an [[http:// | ||
| + | |||
| + | <code bb4w> | ||
| IF lpar% = -1 THEN | IF lpar% = -1 THEN | ||
| SYS " | SYS " | ||
| Line 15: | Line 21: | ||
| ENDIF | ENDIF | ||
| IF wpar% = hEdit% THEN dummy% = FNtrackpopupmenu(EditMenu%, | IF wpar% = hEdit% THEN dummy% = FNtrackpopupmenu(EditMenu%, | ||
| - | In the absence of a menu key the keyboard shortcut **Shift+F10** may be used, however in the BB4W 'main window' | + | </ |
| + | |||
| + | In the absence of a menu key the keyboard shortcut **Shift+F10** may be used, however in the BB4W 'main window' | ||
| + | |||
| + | <code bb4w> | ||
| nsc% = 1 | nsc% = 1 | ||
| DIM accel{(nsc%-1) fVirt&, pad&, key{l&, | DIM accel{(nsc%-1) fVirt&, pad&, key{l&, | ||
| Line 24: | Line 34: | ||
| @haccel% = haccel% | @haccel% = haccel% | ||
| @hwacc% = @hwnd% | @hwacc% = @hwnd% | ||
| + | </ | ||
| + | |||
| Here **contextID%** is a the command code which will be generated. | Here **contextID%** is a the command code which will be generated. | ||
right-click_20context_20menu.1522502378.txt.gz · Last modified: 2024/01/05 00:16 (external edit)