|For many years this was a section on my Programming page, but I haven't used VARPG in years, and it may not even be still available from IBM, so I removed it and put it on a separate page.|
|For several years, beginning in 1995, I used IBM's VisualAge RPG to develop client/server applications. We used to do VARPG presentations and labs with Larry Schweyer and Claus Weiss of IBM at COMMON (perhaps I've even met you there). Since Safety was a beta site for their VARPG development tool we had a special relationship with the Toronto lab, and IBM created a case study webpage about us (and Claus, they misspelled my name).|
VARPG programming tips
|Changing the default action on a project's .ivg file
I liked to put my VARPG projects on a Windows menu, and by selecting the menu option have the GUI designer open the project. By default, if you select a shortcut to a project, or if you double-click on the .ivg file in Explorer it will open up a folder showing you the project's files.
You can change this action with a setting in the Windows registry.
Calling a Windows API
When I first used VARPG it was OS/2 based, and since OS/2 didn't have a taskbar like Windows it had a slightly bigger viewable area of the screen. This is not an issue in most situations, but on the 14-inch monitors with 640x480 resolution that were common back then, I found it limiting. I had created one non-scrollable window that was so big and full of graphics and essential information that when I ported the application over to Windows 95, if the user had the Taskbar property set to be Always on top (my personal preference) the bottom of the window would be hidden behind the taskbar. I decided that rather than require every user of this software to turn off this taskbar setting, or make the taskbar Auto hide, I had to create an Always on top menu option for my window so it could overlay the taskbar (saving this setting for future returns to this screen of course). The way to do this is to call a Windows API to make the window first in the Z-order. I posted this tip on the news400.com website (which I believe is long gone).
This code sets the Always-on-top mode of a window.
You can also call AS/400 API's, but after developing a nice GUI interface to allow users to maintain their AS/400 passwords I found out the hard way that you can run into authority problems in that area.
Surprisingly, VARPG doesn't have a Blink attribute for any parts. To achieve a blinking affect you alternate the Visible attribute of a part between ON and OFF, using a timer part and the TICK event. This technique works for any kind of situation where you want to toggle a visual display. I have also used it to alternate images associated with a part to produce animation. To use it, create a timer part on the window with the Visible attribute set to OFF. Experiment with the Interval and Multiplier attributes to achieve the timing you want. Be aware that since VARPG is single-threaded, depending on what else is occurring in your application you may not always get a perfectly timed blinking effect. The timer can be used for other types of animation, for instance, you can alternate images or change the location (left, top, and bottom attributes) of a part on the window canvas.
Uses the TICK event to blink the text.
Create macros for the LPEX editor
The LPEX editor used by VARPG and CODE is easily customizable with Rexx macros. I have added a menu called Custom that has options on it I want to use often, most having hot-key mnemonics.
Here are 3 of my macros.
Custom.lxl also sets up some other useful RPG actions. If I double-click on a line of code the entire line is highlighted, making cutting & pasting RPG code very easy. Since RPG is a columnized language, pressing Enter to create a new line can cause a problem by breaking up your code if you do this when the cursor is not at the end of a line. I have solved this by creating options to insert a blank line Before (Alt-i) or After (Alt-a) the current line.
And of course, I have also modeled on some SEU actions, Alt-b will go to the bottom of the source and Alt-t will go to the top, and Alt-d will duplicate the current line, making it unnecessary to copy & paste the current line to repeat the code. I have added a toolbar icon for Find next to repeat the most recent Find operation, so you can just click to repeat (like F16 in SEU). Look for it next to the little flashlight icon for Find.
|VARPG related links|