Window Class Library with Command Table Dispatching
Original Publication Date: 1992-Nov-01
Included in the Prior Art Database: 2005-Mar-25
Publishing Venue
IBM
Related People
Abstract
The invention is a software library designed to enhance the productivity of application developers in windowing, event-driven environments such as OS/2* Presentation Manager*, DOS Windows, or X-Windows. An enhanced method for the dispatching of event messages is described. The library is currently implemented in the C++ programming language for the OS/2 PM environment.
Window Class Library with Command Table Dispatching
The
invention is a software library designed to enhance
the productivity of application developers in windowing, event-driven
environments such as OS/2* Presentation Manager*, DOS Windows, or
X-Windows. An enhanced method for the
dispatching of event messages
is described. The library is currently
implemented in the C++
programming language for the OS/2 PM environment.
The prototype
graphical user interface application consists of
one or more loosely coupled visible windows, commonly called dialogs,
created in a supporting environment such as OS/2 Presentation Manager
(PM). We will use the latter, PM, and
its specific implementation to
exemplify application of the invention. The PM component of the
underlying operating system sends event messages to the application,
indicating user action such as keystrokes or mouse input. Typically,
event messages are dispatched for handling to coded procedures that
are associated with each dialog of the application. Messages are
categorized by a type code such as WM_KEYCHAR which indicates that a
user keystroke is being directed to the window. Using the C
programming language, it is typical to write a single window
procedure for every dialog. The address
of the window procedure is
passed to PM when the dialog is loaded or created. As events occur
that pertain to the dialog, PM calls the dialog's window procedure
with arguments that give the message ID code of the event and related
information. The developer will
typically use a switch statement to
break out the handling of the messages.
//
// typical C code window procedure
//
void far *far pascal mywindproc(HWND
hwnd, USHORT msgid,
MPARAM mp1, MPARAM mp2) {
switch(msgid) {
case WM_INITDLG
...call some code
break;
case WM_COMMAND
switch(SHORT1FROMMP(mp1)){
... case handling of
menu items and/or
... dialog
pushbutton commands
}
...call some code
break;
case WM_DESTROY
...call some code
break;
default
return
WinDefWindowProc(hwnd, msgid, mp1, mp2);
}
return WinDefWindowProc(hwnd,
msgid, mp1, mp2);
}
With the
disclosed C++ library, the dispatching of events has
been streamlined so that the developer writes individual handler
member functions only for each specific event which is customized.
Events that handlers are not written for are handled in the library.
The developer do...