GRAPHIC WINDOW TEXT statement

Purpose | Creates a new standalone graphic window.
Syntax | GRAPHIC WINDOW NEW Caption$, x&, y&, nWidth&, nHeight& [,hFont] TO hWinVar [,HIDE|NORMALIZE] GRAPHIC WINDOW TEXT Caption$, x&, y&, nRows&, nColumns& [,hFont] TO hWinVar [,HIDE|NORMALIZE]

Remarks

A Graphic Window is a standalone window which is used to display most any form of text and graphics. After a graphic window has been created with this statement, GRAPHIC ATTACH would normally be used to choose it as the selected graphic target. However, if there is no selected graphic target at the time of creation, the new Graphic Window is automatically attached and selected. You can then draw text, lines, circles, and other forms with various statements.

GRAPHIC WINDOW END can be used to close and destroy the selected Graphic window at any time. Otherwise, the window is automatically destroyed when the program ends.

All PowerBASIC graphical displays are persistent -- they are automatically redrawn for you after resuming from being minimized or temporarily covered by other windows.

The TEXT option is used to create a window oriented more towards the display of text. The size of the window is specified in rows and columns (rather than pixels), based upon the size of initial font -- the default font (MS Sans Serif, 8 point) or the optional initial font specified by the Font parameter. This does not limit the ability to display graphics, as every graphic function is still available. It simply makes it easier to create a window of the desired size. This option is best used with fonts which have a fixed width for each character (Courier, Lucida, etc.).

The parameter Caption$ contains the text to be displayed in the title or caption bar of the graphic window. If caption$ is empty (zero-length), the window is displayed without a title bar, so the appearance is different and the window cannot be dragged by the user.

The parameters x& and y& specify the location of the window, in pixels, relative to the upper left corner of the desktop.

The parameter nWidth& gives the width of the client area of the window, not including the frame. The width is specified in pixels.

The Parameter nHeight& gives the height of the client area of the window, not including the frame. The height is specified in pixels.

The parameter hFont specifies the handle of the initial font to be used in the GRAPHIC WINDOW. If this optional parameter is included, it is the handle of a font created with FONT NEW. This parameter is particularly important when you use the TEXT option, as the size of the window is based upon the size of the initial font. If not included, the default font (MS Sans Serif, 8 point) is selected for you.

The Long/ DWord variable hWinVar receives the handle of the newly created window. If the window could not be created, hWinVar is assigned the value zero (0).

The option words HIDE or NORMALIZE determine whether the window will be made visible immediately. You may wish to initially hide the window so you can first make additional changes to it, such as with the GRAPHIC WINDOW STABILIZE statement. If neither HIDE nor NORMALIZE is chosen, the default is to show it immediately.

A newly-created GRAPHIC WINDOW automatically receives the focus. That is, keyboard input is directed to the graphic window until it is closed, or you choose another focus target.

See also | CONTROL ADD GRAPHIC, GRAPHIC ATTACH, GRAPHIC CELL, GRAPHIC COLOR, GRAPHIC DETACH, GRAPHIC SET AUTOSIZE, GRAPHIC SET CAPTION, GRAPHIC SET CLIENT, GRAPHIC SET CLIP, GRAPHIC SET FIXED, GRAPHIC SET FONT, GRAPHIC SET LOC, GRAPHIC SET OVERLAP, GRAPHIC SET SCROLLTEXT, GRAPHIC SET SIZE, GRAPHIC SET STRETCHMODE, GRAPHIC SET VIRTUAL, GRAPHIC SET WORDWRAP, GRAPHIC SET WRAP, GRAPHIC WINDOW CLICK, GRAPHIC WINDOW END, GRAPHIC WINDOW HIDE, GRAPHIC WINDOW MINIMIZE, GRAPHIC WINDOW NONSTABLE, GRAPHIC WINDOW NORMALIZE, GRAPHIC WINDOW STABILIZE, TXT pseudo-object

Example

FUNCTION PBMAIN () AS LONG

' Create and show a Graphic window on screen

LOCAL hWin AS DWORD

GRAPHIC WINDOW "Box", 300, 300, 130, 130 TO hWin

GRAPHIC ATTACH hWin, 0

GRAPHIC BOX (10, 10) - (120, 120), 0, %BLUE

SLEEP 5000 ' show it for 5 seconds, then end

END FUNCTION