Commenting via shortcut keys in VFP
The comment/uncomment items on the Format menu do not have shortcut keys but they have access keys assigned. Pressing ALT+om and ALT+on on a keyboard will comment/uncomment selected text respectively.
Rick shows in his blog Commenting via ShortCut Key in Visual FoxPro how to implement MS VS shortcut keys CTRL+K+C and CTRL+K+U to comment/uncomment code using KEYBOARD command. The same can be done with Editor functions from Foxtools.fll. It gives more control over the process, like checking if anything is selected, etc.
See George Tasker's Extended Foxtools Help Download #9333 on UT for more info.
| This is sample code. Add error handling and adjust to your requirements as necessary. |
ON KEY LABEL CTRL+K do VsStyleComment ... FUNCTION VsStyleComment LOCAL lnKey, lnWhandle lnKey = INKEY(.5,"HM") lnWhandle = _WonTop() DO CASE CASE lnKey = 3 && Ctrl-C = _EdComment(lnWhandle, 1) CASE lnKey = 21 && Ctrl-U = _EdComment(lnWhandle, -1) ENDCASE ENDFUNC FUNCTION _WonTop SET LIBRARY TO FoxTools ADDITIVE RETURN = _WonTop() ENDFUNC
See Also Copy Command Window Selected Text to Clipboard programmatically, Changing Command Window Font Programmatically, Copy PRG contents to Clipboard
Recent comments
2 weeks 16 hours ago
2 weeks 1 day ago
2 weeks 1 day ago
5 weeks 1 day ago
9 weeks 5 days ago
9 weeks 5 days ago
10 weeks 4 days ago
11 weeks 3 days ago
12 weeks 5 days ago
12 weeks 6 days ago