Character Cells and Proportional Fonts

Converting row/col text screen coordinates to GUI coordinates often results in the objects on some forms and windows not being aligned properly. The primary reasons for this are proportional fonts and the way borders are handled.

The table below describes the differences between character cell and GUI pixel modes:

Character Mode GUI
Each cell is the same size Each cell varies when using proportional fonts.

Borders take up two rows and two columns. The window's full and inside dimensions are generally different (see sw_dim() for switching between the two coordinate systems). Just a few pixels are needed for each border. The window's full and inside dimensions are virtually the same

This changes the WINDOWPTR's rbf/ref - rb/re relationship. In character mode VV, a BDR_DLNP border results in a window the inside dimensions are two rows and two columns less than the full dimensions. Under VV Windows, a BDR_DLNP border provides a window where the full and inside dimensions are the same.

To help resolve these issues, VV Windows provides several window options to modify the placement of objects on the window.

Alignment options:

WN_ALIGNTOP Align to TOP of parent window
WN_ALIGNBOTTOM Align to BOTTOM of parent window
WN_ALIGNLEFT Align to LEFT of parent window
WN_ALIGNRIGHT Align to RIGHT of parent window
WN_ALIGNCLIENT Align to CLIENT area of parent window

Set these options by calling sw_optEx(OPTION, ON/OFF, WINDOWPTR);

i.e. Align the window MyMessageWnp to the bottom of it's parent (probably FULL_WNP)

sw_optEx(WN_ALIGNBOTTOM, ON, MyMessageWnp)

A subsequent call to sw_optEx(WN_ALIGNCLIENT, ON, MyAppForm->wnp) will result in the form window of MyAppForm filling up all the space in the application screen ABOVE MyMessageWnp.

The VVWinDemo example program in the \samples\vvwindemo directory contains a form that demonstrates the placement of object on the screen using these options.


Home Contents Previous Next