|Title: How do I center a window on the desktop?|
To center a window, you could follow the example shown in the $ISCOBOL/sample/iscontrolset/isControlSet.cbl source code:
For example, to obtain the physical screen width in pixels:
After executing the statement above, the physical-screen-width and the physical-screen-height items in the terminal-info group contain the screen dimensions measured in pixels.
The isControlSet.cbl sample uses these measurements to obtain the column and line positions for the centered window:
The isControlSet.cbl sample uses fixed window dimensions, 829 pixels width and 597 pixels height.
However, in the general case a window's real pixel dimensions are based on the font used for the window. If you want to create a generic routine for centering a window, you can use the W$TEXTSIZE library routine to obtain the pixel dimensions of the window. For example, the following subprogram centers a window given a window handle and control font handle:
Please consider that the dimensions obtained do not include the title-bar because it is not part of the client area of the window.
The attached file, w_center.cbl, contains the W_CENTER routine shown above.
|Authored by: Veryant Support on Mon, Nov 1st, 2010 at 7:00 PM
This question has been viewed 7328 times so far.
|Online URL: http://support.veryant.com/support/phpkb/question.php?ID=154|
Powered by PHPKB Knowledge Base Software