Allowing a User to Drag or Resize a Window

Mouse: On PCDOS systems with mouse support, you can allow the user to drag or resize a window interactively with the mouse. See Chapter 43, "The Mouse (PCDOS Only)," for details.

With Keys: If you want to give your users the ability to interactively resize a window or drag it across the screen with the keyboard, (1) #include the vv_wnkt.h header file and (2) call the window drag function, wn_drag(), or the window resize function, wn_resize()

#include <vv_wnkt.h>

int wn_drag(wnp)

WINDOWPTR wnp;        /* Displayed window to drag        */
#include <vv_wnkt.h>

int wn_resize(wnp)

WINDOWPTR wnp;        /* Displayed window to resize        */

Note that you must #include the vv_wnkt.h header file. This is to enable the facilities for the interactive keyboard interface for dragging.

wn_drag() and wn_resize() only work for windows that are already displayed on the screen.

wn_drag() passes control to the user and allows the user to use the cursor pad keys to move the window across the screen. The whole window, including the border, margins, and work area, is dragged. The user can move the window beyond the edge of the screen boundaries, but cannot move the window entirely off the screen. The function returns when the user presses the Quit key or Exit key.

wn_resize() lets the user resize the window with the cursor keys. wn_resize() returns when the user presses the Quit key (KEY_ESC) or Exit key (KEY_F10).

The event table in use for dragging or resizing a window is #defined as Event table:DRAGETP. As with all Vermont Views event tables, you can change the key assignments. You can write your own event functions and install them in the event table. See the Function Reference for a list of event tables.


Home Contents Previous Next