Programming Headers and Footers

Technical Articles > Headers and Footers

Headers and footers are separate text parts which are independent of the main text. When the user alters the text or the text format, for example with a connected button bar, Text Control uses the current input focus, to determine whether the text format of a header, a footer or the main text is changed. The same occurs when the text is manipulated from programming code. For example when a table is inserted from a menu with the TableInsert method, the current input focus determines whether the table is inserted in a header's or footer's text or in the main text.

In addition to this default text part selection, a programmer can use the HeaderFooterSelect method to use a certain property with a certain text part. For example the following code alters the text of a header:

TXTextControl1.HeaderFooterSelect txHeader
TXTextControl1.Text = "This is the header's text"
TXTextControl1.HeaderFooterSelect 0

The first line selects the header, independent of the current input focus, the second line alters the text of the header and the third line returns to the default selection mode. There can be more than one property or method call between the two HeaderFooterSelect calls.

Almost all properties and methods can be used in this way with some exceptions. The following is a complete list of properties and methods which can be used with headers and footers:

The following methods can only be used in conjunction with the HeaderFooterSelect method: