heintzepeewee.enet.dec.com (Sieg Heintze) (07/17/90)
I want to implement some very rudimentary windows in ZORTECH C++ in MSDOS in the absense of MSWINDOWS and X windows. I want to implement this in VGA graphics mode. Bascially I want to draw some rectangles and have the application layer specify routines to be executed when the following events occur. (1) When the mouse pointer enters the rectangle. (2) When the mouse leaves the rectangle (3) When the user single clicks in the window - left, right or both buttons. (4) When the user double clicks in the window. I will call these mouse event routines. I figure I'll have a double linked list of a class called window. Most of the time I'll only be interested in single clicks and want nothing to happen when the other events occur. Question #1. Are there any tutorials that cover this subject? I checked into "User Interfaces in C++ and Object-oriented Programming" but they just stick with text mode and don't user the mouse much. Question #2. What would your definition of the window class look like and what would the constructor look like? Would you use an array to store the addresses of the above mouse event routines or use separate class fields? How can you write a constructor that will let the application layer specify any number (or none) of the above event routines? Question #3. I think I would like to make it asynchronous by using the MSDOS hook into the mouse interupt. (There is a MSDOS function to do this). So everytime a event occurs with the mouse, my routine would execute and perform a linear search on the set of rectangles (by comparing coordinates) to determine if any of the above mouse event routines should be invoked. This seems very slow. How does X-Windows and MSWindows deal with this? heintze@genral.enet.dec.com Digital Equipment Corporation 1110 Chapel Hills Drive CXN2-2/35 Colorado Springs, CO 80920-3995 719-260-2184