In this post, I’ll show you how to use the AutoHotKey system utility to make a simple script file to quickly automate zooming the font size up and down in the FoxPro IDE using keyboard shortcuts or the mouse wheel. This is a common feature in most modern code editors, but it is not a native feature of our much older FoxPro IDE. (Jim Nelson gave me this idea when he explained you can Enlarge and Reduce the code window font size through the Format menu when you are working in a code window). So, I used AutoHotKey, which is a tool that can be used to create macros and scripts keyboard shortcuts and mouse gesture for any app running on your Windows machine. It allows for very complex hotkey and mouse combinations that FoxPro macros do not support. This quick-zoom feature is something that most modern IDE’s have and I’ve badly wanted this feature in FoxPro for a long time.
Video demo:
FoxPro IDE does font-zooming : http://www.youtube.com/watch?v=oRjMC-IDmKQ
With these hotkeys (Ctrl+NumPadPlus , Ctrl+NumPadMinus) or mouse (Ctrl+MouseWheelUp, Crtl+MouseWheelDown) you can quickly increase or decrease the font size in the code window, multiple times, if desired, to create a zoom-in or zoom-out effect.
Keyboard:
- ControlKey + the [PLUS] key on the number pad of your keyboard to zoom the font larger.
- ControlKey + the [MINUS] key on the number pad of your keyboard to zoom the font smaller.
Mouse:
- ControlKey + [Mouse Wheel] to zoom the font larger or smaller. Try it in both directions to see which way it goes. If you want to reverse the direction of wheel behavior, just edit the script to reverse the WheelUp/WheelDown assignments, or use the X-Mouse Button Control utility to reverse the mouse wheel direction for your whole system.
Here are the scripts:
(Save to your .ahk file, then double-click the file in Windows File Explorer to activate the macros.)
Note that AutoKey allows you to restrict these assignments based on the Window handle, so they will only affect the FoxPro App, as these macros would likely not work in the menu system of any other app.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#IfWinActive ahk_class vfp99400000 ^numpadadd::Send {ALTDOWN}O{ALTUP}E ^numpadsub::Send {ALTDOWN}O{ALTUP}R ^WheelUp:: SendInput {ALTDOWN}O{ALTUP}R SLEEP,50 return ^WheelDown:: SendInput {ALTDOWN}O{ALTUP}E SLEEP,50 return #IfWinActive |
Go from this:
To this:
by pressing the hotkeys or Ctrl+MouseWheel to zoom in or out as much as you want.
Here’s my conference editor setup utility:
*—————————————————————–
* Get a handle to the edit window
*—————————————————————–
Local lnWHandle
If not “FOXTOOLS” $ Upper( Set(“Library”) )
Set Library to (Home()+”\FoxTools.Fll”) Additive
Endif
lnWHandle = _WOnTop()
If m.lnWHandle <= 0
Return
Endif
*—————————————————————–
* Get current settings
*—————————————————————–
Local laEnv[25]
If _EdGetEnv( m.lnWHandle, @laEnv ) == 0
Return
Endif
*—————————————————————–
* Settings. Look up ToolHelp.Zip for possible values.
*—————————————————————–
laEnv[22] = "Courier New"
laEnv[23] = 18
laEnv[24] = 1
*————- —————————————————-
* Update settings
*—————————————————————–
_EdSetEnv( m.lnWHandle, @laEnv )
_wputchr( m.lnWHandle, 65 )
LOVE IT, thank you! I reversed my wheel direction, because for me it feels natural to have the text enlarge when the mouse wheel goes up.