This program shows how to use Gpf to create views of WPS objects and how to access
instance variables of a WPS object from a with Gpf created view.
The sample code also demonstrates how to create and implement new WPS objects
with modified popup menues.
The purpose and contents of some important files
SIM.DLL
is the implementation of a new WPS class SIM. The class is derived from WPAbstract.
SIM.CSC
the OIDL interface definition of SIM. This file is used as input to the SOM compiler (sc) to create the skeleton for SIM's implementation (SIM.C, SIM.H, SIM.IH.....) In SIM.C you see how to
update a popup menu and ho to respond to the opening of a view.
The view was created with Gpf, and the only think you have to do is to setup a parameter structure and call the Show<nameofwindow> function generated by Gpf.
THE TRICKY PARTHERE WAS THAT YOU MUST PASS somThis AND somSelf IN A PARAMETER
STRUCTURE TO THE GPF WINDOW!!!!!!!!!!!!!!!!!
AAA.DLL
contains the view generated by Gpf. You just tell Gpf to create a DLL, design the window, write the user functions and attach them to important messages.
UFAAA.C
This file contains all user functions for the window.
HAVE A SPECIAL LOOK AT THE USER FUNCTIONS FOR INITIALIZATION AND DESTRUCTION
OF THE GPF WINDOW!!!!!!!!! These user functions must be used unchanged in your
application. All other code is business as usual!
TRYSIM.C
This is a small C file registering, deregistering the new WPS class and creating a new
instance of the class SIM. BEFORE YOU USE THIS FUNCTION MAKE SURE, THAT THE DLLS
SIM.DLL AND AAA.DLL HAVE BEEN COPIES TO A LIBPATH DIRECTORY.
TRYIT.CMD
This batch file invokes TRYSIM.EXE with several parameters.
After the execution of TRYIT you should get a SIM object with name My and an ugly
face as icon. When you double click on it you should get the Window created with Gpf.
It contains an entry field and a button (if you get first a message box telling you that
it couldn't find help, you should copy the file AAA.HLP to a help directory.
When you press the button the number of th current icon is displayed (1, 2 or 3). This
demonstrates how to access instance data from Gpf. Please notice, that you are able to
use WPS methods from Gpf if you know the right object handle.
Now you can change the icon. Press button 2 over the icon (or press button 1 over the
system icon of the Gpf window). The pupup menu contains the entry DEFAULT ICON.
Select the enty and select in the appearing cascaded menu Icon 1, 2 or 3. Notice the
immediate change of the system icon in the Gpf window.
If you would like to have several instances of the Gpf window change the standard
settings.
I hope that I structured and wrote the program clear enough to follow it. If you have questions feel free to drop me a line on CompuServe.
My ID is 72557,1153, or
start a discussion in the Gpf forum, or
send me a fax to +49 (Germany)30 (Berlin) 825 30 14