Silverfrost Logo About Us | Contact Us

Text array - %N.Mtx[options]

Text arrays provide a convenient way to display a grid of characters with 'attributes' to achieve an effect analogous to that achieved under DOS by writing to the screen buffer. A text array can respond to keyboard and mouse input via its call-back function by using clearwin_info@ (see below), updating the array as necessary. The text array format takes two character strings and two integer modifiers N, and M.

For example:

      CHARACTER*800 text,attr
      INTEGER k,winio@
      text='Test colour'
      CALL char_fill@(attr,char(0))
      CALL char_fill@(attr(1:4),char(1))
      CALL char_fill@(attr(6:11),char(2))

In the above example, the text array text is displayed in the box as an 80 x 10 array of which initially only 60 x 8 is visible. The size of the control can be varied if it is preceded by a pivot (%pv) in a variable sized window. The attr array contains attribute numbers stored using CHAR(i) where 0 < i < 255. Zero is the default attribute (usually black on white), others are defined by subsequent %tc[fgcolour]%ty[bgcolour] format pairs. The first %tc%ty pair defines colour index 1and so on. fcolour is the foreground colour of the text, and bgcolour is the background. In the above example, the word 'Test' appears as blue on a red background whilst the word 'colour' appears as yellow on a green background. The colour can be specified as an RGB@ value in the argument list if the colour in brackets is omitted. Changes in font attributes (underlining, etc.) are not possible with %tx.

%tx may have a call-back functino that can use the following clearwin_info@ strings:


value of key pressed


holds the new value on resizing


mouse button press information


text array window dimension change


holds the new value on resizing


holds the new value on resizing


location x when the mouse is pressed in %tx


location y when the mouse is pressed in %tx

The TEXT_ARRAY_RESIZING parameter is set to one only in a call-back responding to a re-sizing event. The next two parameters in the table only have meaning in this context. They supply the new size of the control in average characters.

The TEXT_ARRAY_X and TEXT_ARRAY_Y parameters give the mouse position in characters from the top left corner, and are zero based. The mouse flags, that contain information about which mouse button (if any) is depressed, can be obtained by a call to get_mouse_info@. The option FULL_MOUSE_INPUT is specified in order to force the call-back function to be called whenever the mouse moves over the control.

TEXT_ARRAY_MOUSE_FLAGS uses bitwise flags as follows:



Left mouse button depressed



Right mouse button depressed



Keyboard shift key depressed



Keyboard control key depressed



Middle mouse button depressed

By default, the call-back function is called when a keyboard character is received while the control has the focus. The character is placed in the parameter TEXT_ARRAY_CHAR. If the option FULL_CHAR_INPUT is specified, the call-back function receives each keystroke using the Microsoft VK_ parameters (defined in the file windows.ins). The call-back is invoked for each key press and each key release. In the latter case TEXT_ARRAY_CHAR parameter has the top bit set. The parameter TEXT_ARRAY_CHAR will be zero when not in use. To respond to ALT key combinations you should use the %ac facility rather than tracking the ALT key with FULL_CHAR_INPUT. This is because messages associated with the release of the ALT key might be delayed until the next key is pressed. The option USE_TABS may be used to cause the tab key to be passed to the call-back rather than performing its normal Windows function of moving between controls.

The system font is used in a %tx control, unless %fn appears before %tx. If %fn is used then a mono-spaced font (such as Courrier New) should be selected because the text array must be aligned both vertically and horizontally.

Note that the text array is not re-dimensioned if the control is re-sized. Re-sizing simply changes the region that is visible.



Copyright © 1999-2017 Silverfrost Limited