The Text Objects: 5 Using VisText

Up: GEOS SDK TechDocs | Up | Down | Prev: 4 Text Object Chunks | Next: 6 Using GenText

This section describes how to use a VisText object. At the time of documentation printing, VisTextClass is undergoing improvement and will therefore be covered fully in future documentation releases. This section currently gives much useful information about the class, however.

VisText Instance Fields shows all the instance data fields of VisTextClass . Following the display are descriptions of the individual fields.

Code Display 10-19 VisText Instance Fields

 /* These are all the instance data fields of the VisText. Many of them are used
 * internally by the class and should not be used by applications. Because they
 * are documented as internal, Geoworks reserves the right to change their meaning
 * or use at any time. Those that are internal are clearly noted as such. */
@instance ChunkHandle				VTI_text;
@instance word				VTI_charAttrRuns = VIS_TEXT_INITIAL_CHAR_ATTR;
@instance word				VTI_paraAttrRuns = VIS_TEXT_INITIAL_PARA_ATTR;
@instance VMFileHandle				VTI_vmFile = NullHandle;
@instance word				VTI_lines = 0;				/* INTERNAL */
@instance VisTextStorageFlags				VTI_storageFlags = (VTSF_DEFAULT_CHAR_ATTR |
						 VTSF_DEFAULT_PARA_ATTR);
@instance VisTextFeatures				VTI_features = 0;
@instance VisTextStates				VTI_state = 0;
@instance VisTextIntFlags				VTI_intFlags = 0;				/* INTERNAL */
@instance VisTextIntSelFlags				VTI_intSelFlags = 0;				/* INTERNAL */
@instance GSRefCountAndFlags				VTI_gsRefCount = 0;				/* INTERNAL */
@instance GStateHandle				VTI_gstate = NullHandle;				/* INTERNAL */
@instance word				VTI_gstateRegion = -1;				/* INTERNAL */
@instance dword				VTI_selectStart = 0;
@instance dword				VTI_selectEnd = 0;
@instance PointDWord				VTI_startEventPos = {0,0};				/* INTERNAL */
@instance dword				VTI_selectMinStart = 0;				/* INTERNAL */
@instance dword				VTI_selectMinEnd =0;				/* INTERNAL */
@instance dword				VTI_lastOffset = 0;				/* INTERNAL */
@instance word				VTI_goalPosition = 0;				/* INTERNAL */
@instance Point				VTI_cursorPos = {0,0};				/* INTERNAL */
@instance word				VTI_cursorRegion = 0;				/* INTERNAL */
@instance word				VTI_leftOffset = 0;				/* INTERNAL */
@instance byte				VTI_lrMargin = 0;
@instance byte				VTI_tbMargin = 0;
@instance ColorQuad				VTI_washColor = {
					C_WHITE,
					CF_INDEX,
					0, 0 }
@instance word				VTI_maxLength = 10000;
@instance VisTextFilters				VTI_filters = 0;
@instance optr				VTI_output;
@instance WBFixed				VTI_height = {0,0};				/* INTERNAL */
@instance word				VTI_lastWidth = -1;				/* INTERNAL */
@instance TimerHandle				VTI_timerHandle = NullHandle;				/* INTERNAL */
@instance word				VTI_timerID = 0;				/* INTERNAL */

VTI_ text stores the ChunkHandle of the object's text chunk. This chunk will be stored within a chunk in the same resource as the text object. See The Text for a full discussion of how to manipulate and alter text.

VTI_ storageFlags contains flags related to how a VisText object stores its paragraph and character attributes. The composition of these flags affects the function of VTI_ charAttrRuns and VTI_ paraAttrRuns .

VTI_ charAttrRuns stores the character attributes for the text object. Depending on VTI_ storageFlags , this instance field may contain a 16-bit record, a ChunkHandle to a VisTextCharAttr structure, or a ChunkHandle to a chunk array of character style runs.

VTI_ paraAttrRuns stores the paragraph attributes for the text object. Depending on GTI_ storageFlags , this instance field may contain a 16-bit record, a ChunkHandle to a VisTextParaAttr structure, or a ChunkHandle to a chunk array of paragraph style runs.

VTI_ features stores a VisTextFeatures record to display text within this text object. These features allow such utilities as word wrapping, hyphenation, smart quotes, etc.

VTI_ state stores different states of type VisTextStates that the text object can operate under, such as editable, selectable, targetable, etc.

VTI_ vmFile stores the handle for a text object's associated VM file; this VM file will store the text if the text object incorporates the large model. This instance field is only used for text objects using the large model.

VTI_ selectStart stores the character position of the selection's start. VTI_ selectEnd stores the character position of the selection's end. If both the selection start and selection end coincide, there is no selected text.

VTI_lrMargin stores the left and right margins of the paragraph in points. VTI_ tbMargin stores the top and bottom margins of the paragraph in points.

VTI_ washColor stores the background color (of type ColorQuad ) of the text object.

VTI_ maxLength stores the maximum number of characters allowed in this text object (for non-large objects).

VTI_ filters stores the VisTextFilters in use by this text object. Filters allow your text object to accept or reject certain sets of characters.

VTI_ output stores the destination for actions taken by this text object.

Code Display 10-20 VisText Variable Data

@vardata word		ATTR_VIS_TEXT_TYPE_RUNS;
@vardata word		ATTR_VIS_TEXT_GRAPHICS_RUNS;
@vardata word		ATTR_VIS_TEXT_REGION_ARRAY;
@vardata word		ATTR_VIS_TEXT_STYLE_ARRAY;
@vardata word		ATTR_VIS_TEXT_NAME_ARRAY;
@vardata word		ATTR_VIS_TEXT_SELECTED_TAB;
@vardata void		ATTR_VIS_TEXT_DO_NOT_INTERACT_WITH_SEARCH_CONTROL;
@vardata VisTextExtendedFilterType ATTR_VIS_TEXT_EXTENDED_FILTER;
typedef struct {
    word			VTSD_count;
    VisTextRange			VTSD_recalcRange;
    VisTextRange			VTSD_selectRange;
    dword			VTSD_showSelectionPos;
    WordFlags			VTSD_notifications;
    byte			VTSD_needsRecalc;
} VisTextSuspendData;
@vardata VisTextSuspendData ATTR_VIS_TEXT_SUSPEND_DATA;
@vardata void		ATTR_VIS_TEXT_NOTIFY_CONTENT;
@vardata void		ATTR_VIS_TEXT_DO_NOT_NOTIFY_CONTENT;
@vardata void		ATTR_VIS_TEXT_SEND_CONTEXT_NOTIFICATIONS_EVEN_IF_NOT_FOCUSED;
typedef struct {
    wchar		VTCFD_startOfRange;
    wchar		VTCFD_endOfRange;
} VisTextCustomFilterData;
@vardata ChunkHandle ATTR_VIS_TEXT_CUSTOM_FILTER;
@vardata word		ATTR_VIS_TEXT_CHAR_ATTR_INSERTION_TOKEN;
@vardata word		ATTR_VIS_TEXT_TYPE_INSERTION_TOKEN;
@vardata void		ATTR_VIS_TEXT_UPDATE_VIA_PROCESS;
@vardata void		ATTR_VIS_TEXT_DOES_NOT_ACCEPT_INK;
@vardata WBFixed		ATTR_VIS_TEXT_MINIMUM_SINGLE_LINE_HEIGHT;
@vardata word		ATTR_VIS_TEXT_ADD_SPACE_TO_ALL_LINES;
@vardata void		ATTR_VIS_TEXT_DONT_SHOW_POSITION_ON_GAINED_TARGET_EXCL;
@vardata void		ATTR_VIS_TEXT_SHOW_POSITION_ON_GAINED_TARGET_EXCL;
@vardata void		ATTR_VIS_TEXT_DONT_BEEP_ON_INSERTION_ERROR;

ATTR_VIS_TEXT_TYPE_RUNS specifies the Type runs for this text object. You should not need type runs unless you need hyperlink capabilities. ATTR_VIS_TEXT_GRAPHIC_RUNS specifies a graphics run to use within the text object.

ATTR_VIS_TEXT_REGION_ARRAY specifies the array of regions defined for this text object. Text within the VisText will flow from each of the defined regions to the next region. ATTR_VIS_TEXT_STYLE_ARRAY specifies the name array of styles used in the VisText's style sheets.

ATTR_VIS_TEXT_SELECTED_TAB specifies the position of the currently-selected tab, if any.

ATTR_VIS_TEXT_DO_NOT_INTERACT_WITH_SEARCH_CONTROL instructs the text object not to send the search-control notification.

ATTR_VIS_TEXT_EXTENDED_FILTERS stores the VisTextExtendedFilterType to use instead of the VisTextFilters stored within VTI_ filters . Extended filters offer more powerful (and complex) filtering mechanisms for accepting and rejecting text. Including this attribute will affect the performance of your text object, however.

ATTR_VIS_TEXT_SUSPEND_DATA stores data to be used by the text object during a SUSPEND/UNSUSPEND operation ( VisTextSuspendData ).

ATTR_VIS_TEXT_SEND_CONTEXT_NOTIFICATIONS_EVEN_IF_NOT_FOCUSED sends out context notification even if the object is not focused. Applications must make sure that objects with this attribute do not get modified while another text object has the focus.

ATTR_VIS_TEXT_UPDATE_VIA_PROCESS indicates that status updates must be sent via the process object (usually because there are targetable text objects in multiple threads).

ATTR_VIS_TEXT_DOES_NOT_ACCEPT_INK indicates that the VisText object will not accept ink.

ATTR_VIS_TEXT_MINIMUM_SINGLE_LINE_HEIGHT defines the height of one-line text objects so that custom graphics, etc. can be placed inside the text object.

ATTR_VIS_TEXT_ADD_SPACE_TO_ALL_LINES adds additional spacing above all lines in a text object, and it takes a word argument. This optional attribute is intended to be added to objects that use accent characters that may draw above the top of the text's "font box." This spacing value differs depending on the system that text is implemented on; only use this attribute if redraws are not drawing your text characters properly. This attribute will also affect any text lines that contain borders, adding additional space between the text and the border.

ATTR_VIS_TEXT_DONT_SHOW_POSITION_ON_GAINED_TARGET_EXCL and ATTR_VIS_TEXT_SHOW_POSITION_ON_GAINED_TARGET_EXCL affect the display of the cursor within a text object upon gaining the target exclusive. By default, a VisText object will display the cursor upon gaining the target; a VisLargeText object, on the other hand, will not display this position. You may use either of these hints to override this default behavior.

ATTR_VIS_TEXT_DONT_BEEP_ON_INSERTION_ERROR indicates that the VisText object should not call the default error sound routine in cases where an insertion error occurs.


Up: GEOS SDK TechDocs | Up | Down | Prev: 4 Text Object Chunks | Next: 6 Using GenText