%gr - Graphics Region

Purpose

To provide a rectangular area for use with drawing surface routines.

Syntax

winio@('%gr[options]', widthheight)
winio@('%`gr[options]', widthheight, uid)
integer widthheight, uid     (input)

Modifiers

Grave accent (`) - used to input a user identifier for the graphics area.

Caret (^) - used to supply a call-back function.

Question mark (?) - a help string is supplied.

Description

width and height provide the pixel dimensions of the area. uid is a programmer-supplied identifier to distinguish between different graphics areas.

%gr can be preceded with %pv (Pivot) in order to re-size the area at run time. For more details about this very versatile feature you should see the section: Graphics Topics and drawing surfaces.

Options

BLACK, WHITE, RED, BLUE, YELLOW, GREY (or GRAY)

Specifies the initial background colour of the drawing surface. Otherwise this defaults to the background colour of the surrounding window.

COLOUR=#rrggbb

COLOR=#rrggbb

Specifies the intial background colour of the drawing surface where rr represents hexadecimal digits for the red component etc..

METAFILE_RESIZE USER_RESIZE

Options specifying the behaviour of the graphics area as it is re-sized. See later in this chapter.

RGB_COLOURS

Selects rgb colour mode. This is the default for ClearWin+ releases including and after FTN95 7.00.

VGA_COLOURS

Selects vga colour mode. This is the default for ClearWin+ releases before FTN95 7.00.

FULL_MOUSE_INPUT

Specifies that mouse movements and mouse button releases should be notified to the call-back function, not just clicks and double clicks.

POPUP

Used with FULL_MOUSE_INPUT in order to enable a %pm (Popup Menu) popup menu that is otherwise disabled.

BOX_SELECTION
LINE_SELECTION
FREE_SELECTION

Specifies the initial selection mode, that controls the behaviour when the user presses the left mouse button and drags the mouse over the graphics area. These options are useful for interactive programs.

USER_SURFACE

An option to enable software to access the in-memory copy of the graphics area so as to modify it at the highest possible speed. This option is particularly useful for image processing software.

FLUSH

Used with %sy (Dialog Style) 3d-styles to re-align the %gr border.

SMOOTH4 Use high-resolution 8x4 box filter anti-aliasing
SMOOTH8 Use 8x8 box filter box filter anti-aliasing
HSCROLL, VSCROLL

Adds scrolling options. Previously %vx and %hx could be used with %gr but provided scroll bars as separate controls. The new options create scroll bars that are built into the control and as a result have all of the expected "hot track" characteristics of a scroll bar.

%gr[hscroll] uses the same data as %hx whilst %gr[vscroll] uses the same data as %vx. This is accommodated by presenting %hx with its data before %gr[hscroll] and %vx with its data before %gr[vscroll]. The only restriction is that the %hx and %vx informatin must not include callback functions. For example:

integer iw,page,range,pos
integer,external::cb
iw = winio@("%vx&", page, range, pos)
iw = winio@("%^gr[vscroll]",400,300,cb)

The values used for 'page' and 'range' determine the y offset of the origin when drawing to the graphics region. Typically the adjustment could be y = y-pos*range. In this way, %gr can be used to display a snapshot of a larger graph by redrawing the area required. Alternatively a full sized graphics region could be created off-screen, with areas copied to the %gr region as required.

See also

%dw (Owner Draw Graphics)

 

 

Basket
Empty
 
Copyright © 1999-2020 Silverfrost Limited