Sample code to demonstrate how to manage control windows directly from a normal PM client window. Source code included.
Program is distributed as ZIP package: download to temporary directory and unpack to destination folder. See below for download link(s).
Following ones are the download links for manual installation:
| Client Views v. 1.1 (6/5/1991, James Scott) | Readme/What's new |
IBM License Agreement for CLIENV
IF YOU DOWNLOAD OR USE THIS PROGRAM YOU AGREE TO THESE TERMS.
International Business Machines corporation grants you a license
to use the Program only in the country where you acquired it.
The Program is copyrighted and licensed (not sold). We do not
transfer title to the Program to you. You obtain no rights other
that those granted you under this license.
Under this license, you may:
1. use the Program on one or more machines at a time;
2. make copies of the Program for use or backup purposes within
your Enterprise; and
3. modify the Program and merge it into another program.
You must reproduce the copyright notice and any other legend of
ownership on each copy or partial copy, of the Program.
Except as expressly provided in the DAPTOOLS LIBRARY License
Agreement (TOOLIC.TXT), you may NOT:
1. distribute the program in any manner, including through
electronic bulletin board systems or other means;
2. sublicense, rent, lease, or assign the Program; and
3. reverse assemble, reverse compile, or otherwise translate
the object code of the Program.
We do not warrant that the Program is free from claims by a third
party of copyright, patent, trademark, trade secret, or any other
intellectual property infringement.
Under no circumstances are we liable for any of the following:
1. third-party claims against you for losses or damages;
2. loss of, or damage to, your records or data; or
3. economic consequential damages (including lost profits or
savings) or incidental damages, even if we are informed of
their possibility.
Some jurisdictions do no allow these limitations or exclusions,
so they may not apply to you.
We do not warrant uninterrupted or error free operation of the
Program. We have no obligation to provide service, defect
correction, or any maintenance for the Program. We have no
obligation to supply any Program updates or enhancements to you
even in such are or later become available.
IF YOU DOWNLOAD OR USE THIS PROGRAM YOU AGREE TO THESE TERMS.
THIS PROGRAM IS PROVIDED "AS IS" WITHOUT ANY WARRANTIES, EXPRESS
OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE.
Some jurisdictions do not allow the exclusion of implied
warranties, so the above exclusion may not apply to you.
You may terminate this license at any time. We may terminate
this license if you fail to comply with any of its terms. In
either event, you must destroy all your copies of the Program.
You are responsible for the payment of any taxes resulting from
this license.
You may not sell, transfer, assign, or subcontract any of your
rights or obligations under this license. Any atdttempt to do so
is void.
Neither of us may bring a legal action more than two years after
the cause of action arose.
If you acquired the Program in the United States, this license is
governed by the laws of the State of New York. If you acquired
the Program in Canada, this license is governed by the laws of
the Province of Ontario. Otherwise, this license is governed by
the laws of the country in which you acquired the Program.
-----------------------------------------------------------------------------
┌──────────────────────────────────────────────────────────────────────────┐
│ Package Name: CLIENTV Client Views │
│ Program Name: CLIENTV.EXE V1.1 │
└──────────────────────────────────────────────────────────────────────────┘
Date :4/24/1991
Support or Comments: Author
Author: James Scott
: IBM Senior Systems Engineer
Objective: Demonstrate how to manage control windows directly from a
normal PM client window. Include scrolling, keyboard
mnemonic, and tabbing focus management example. Also
provides a Rexx exec to convert DLGBOX.EXE output to
WinCreateWindow() calls, converting dialog units to pels.
Program Function
Create Dialog Controls in a Client window, without dialogbox.
Scroll Bars and Sizing functions WORK.
Active menu options
- File.Exit System Exit
- View.Full Show Full Panel
- View.Short Output from DlgToWin.cmd
- View.Buttons Radio, checkbox, pushbutton
- View.Dlg Test Combobox, checkbox, entryf
Routines provided:
- QueryDialogUnits() Ask system for default char info.
- CreateFullView() Create controls using Resolution Units
- CreateShortView() Create controls using Dialog Units
-
- CreateButtonView() Create controls using Dialog Units
- CreateDlgView() Create controls using DlgUnits
- GetWindowList() Discovers SWP for each controls
- GetViewSWP() Discovers area used by controls
- used for scrolling: x, y, cx, cy
- private to GetWindowList()
- ClearView() Destroys the current set of controls/view
- TabGroupControl() Manages keyboard/mouse input like dlgbox.
- Keyboard Mnemonics for buttons
- Default button support
- Focus Group Processing
- Tab processing
- HandleHScroll() Determines scroll bar increment X.
- HandleVScroll() Determines scroll bar increment Y.
- ScrollView() Determines if scroll bars are needed.
- PanelScroll() Actually move all the controls (scroller)
- Misc PM Functions PresentationParms, MemoryAllocation, etc
*** New ** - DlgToWin.Cmd Rexx exec to convert output from DlgBox.exe
to a C file which creates a View.
- WinCreateWindow() from CONTROL ...
- Maps dialog units in output file.
┌─────────────────────────────────────────────────────────────────────────┐
│ Author: James Scott │
│ : IBM Senior Systems Engineer
-----------------------------------------------------------------------------
┌──────────────────────────────────────────────────────────────────────────┐
│ Package Name: CLIENTV Client Views │
│ Program Name: CLIENTV.EXE V1.1 │
└──────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────┐
│ Demo │
└─────────────────────────────────────────────────────────────────────────┘
Try running the demo file "clientv.exe" first. Please notice the following
A. The initial position and size of the standard window.
B. The first view shown on the client is Menu.View(Full)
1. Notice its position and orientation to the client.
2. Try using the scroll bars features.
3. Notice the way the client repaints. ***
C. Try all the Views; Full, Short, and Buttons.
D. Use the tab keys, enter/newline, mnemonics.
E. Resize any window from the bottom up, top down, left/right and notice
the views response. It should not move from its top left anchor.
F. End.
┌─────────────────────────────────────────────────────────────────────────┐
│ Source files Description │
└─────────────────────────────────────────────────────────────────────────┘
CLIENTV Make
CLIENTV.H Header, typedefs for Window Words, macros
CLIENTV.C PM main and client window proc
CLIENTV0.C Major support routines - see announcement
CLIENTV1.C StatusLine subclass create and window proc
CLIENTV2.C Service routines, time, date, centerwindow, etc.
CLIENTV3.C Sets of WinCreate to make (control)views
CLIENTV.RC Resources
CLIENTV.DEF Link definition
CLIENTV.DLG (Not compiled) Template for DLGTOWIN.CMD (rexx exec)
CLIENTV.IPF Dummy file for help
* DLGTOWIN.CMD Converts DLGBOX Output.dlg to Output.v, Output.vh
- Output.Dlg is the normal output from dialog box editor.
- Output.V is generated C procedure using WinCreateWindow
to reproduce the dialog.
- Output.VH is the C declarations for each dialog routine.
┌─────────────────────────────────────────────────────────────────────────┐
│ Usage │
└─────────────────────────────────────────────────────────────────────────┘
I wrote these routines to be portable between application, they could even
be placed in a DLL. There are several things you must do to reuse these
routines and I will try to explain those requirements step by step.
Only for the scrolling & tabbing function.
1.PM Main.
a. WinRegisterClass...ALLOC_WINWRD Reserve 8+ Window Words
2.Client Window Proc QueryWindowWord #3, set pScl pointer.
a. WM_CREATE: Allocate PSCROLLINFO
Store in Client ALLOC_SCROLL offset
QueryDlgUnits - store in SCROLLINFO
b. UM_CREATE: Create Controls on Client
GetWindowList(hwnd);
ScrollView(hwnd);
c. WM_SIZE: Adjust scrollinfo.YPos
ScrollView()
d. WM_HSCROLL: HandleHScroll()
WM_VSCROLL: HandleVScroll()
e. WM_CHAR: TabGroupControl()
3.Application Header
a. constant WNDCOL Scroll increments
constant WNDROW Scroll increments
b. constant ALLOC_WINWRD Reserve 8+ Window Words
constant ALLOC_SCROLL Window Word #3
c. constant MAX_CONTROLS Set maximum number of windows
typedef struct PSCROLLINFO Include this memory typedef
ToDos.
1. You will need to reserve space for at least three window words while
registering your clientwindow classname.
2. a.Allocate a segment of memory large enough to hold the SCROLLINFO
structure. Save the far pointer of this memory in window word #3 of
the client area. The client does not have a size at this time so we
post a message (WM_USER) to ourselves, hoping that by the time we
get that message off the queue we will have a window size. Call
QueryDlgUnits once to get the current X/Y Dialog Units for Display.
b.Create the controls on the client window. I wrote a routine to do this
two different ways; using dialog units, and pels. The DLGTOWIN.CMD will
convert the output of DLGBOX.EXE to a C procedure that creates the View
using WinCreateWindow() calls and mapping Dialog Units to Pels.
MAX_CONTROLS controls the maximum number that will be scrolled. Use the
HWND_BOTTOM option on all WinCreateWindow calls for controls, HWND_TOP
cause the tabbing function to work backwards. ZORDER
Next call the GetWindowList routine, which sets up the scrolling
structures. Lastly call the ScrollView routine which will initialize
the view and scroll bars.
c.When the client window size changes we capture on the new cy value for
scrolling purposes. The cx is not needed. WM_SIZE include the old and
the new cx, cy values. I calculate the difference like this;
..scroll.yinc ...new ...old
pScl->YPos += (SHORT2FROMMP(mp2) - SHORT2FROMMP(mp1));
note the use of "pScl" a far pointer to the (2.a)memory segment. When
you have the offset call the ScrollView routine to adjust the view.
d.Simply call the right routine Handle[V|H]Scroll, and it shall be done.
e.First call TabGroupControl to process the keystroke. If the return
value is negative - you should call the defaultwindow procedure.
3.The CLIENTV.H file is loaded with things that I keep around when programming
in PM. Use what you need. I have used the DLGBOX editor as the Screen
layout tools.
Use the QueryDlgUnits(ScrollInfo.xDlg,yDlg) values during the
WinCreate calls. I have more work to do with dialog units,
"what/where are they?". I want a easy way to create views that look the
same across the 8514 and VGA adapters.
┌─────────────────────────────────────────────────────────────────────────┐
│ Changes │
└─────────────────────────────────────────────────────────────────────────┘
This code represents a significant effort on my part. If you have questions
of answers, please pass them on me. I will do my best to be helpful.
I believe we all should "GIVE SOMETHING BACK".
04-24-1991 Initial Release
04-25-1991 Fixed Mnemonic tests in amgr_pnl.c, added buttons panel
04-26-1991 General cleanup of amgr_pnl.c modules, to reduce parmlist
04-27-1991 Changed Package Source file names to ClientV
04-29-1991 Changed GetViewSWP() to align the view to the client TopLeft corner
* Created XPelDlg(), YPelDlg() MACROS in CLIENTV3.C to use the
dialog units calculated by QueryDlgUnits and stored in SCOLLINFO.
* Added a menu item View.Dlg_Test which uses this dialog unit info
to create a view from the EDITED DlgBox.exe output file.
05-06-1991 Added DLGTOWIN.CMD - a rexx exec that converts the output of the
dialog box editor to C routines that recreate the dialog using
* Major * WinCreateWindow() calls. Also maps dialog units to pels in the
output file. CreateShortView() is example output from this exec.
THIS IS THE LAST PLANNED CHANGE TO THIS PACKAGE, UNLESS YOU
PROMPT ME FOR MORE ???
┌─────────────────────────────────────────────────────────────────────────┐
│ James Scott Jr. Profs CHGVMIC4(JSCOTT) IBM T/L 688-4213 │
└─────────────────────────────────────────────────────────────────────────┘ |
hobbes.os-2.in/download/os2/dev-4/samples-2/pm/Clienv_1-1.zip |

This work is licensed under a Creative Commons Attribution 4.0 International License.
Add new comment