MYTUI

Rapid TUI Application Development

CURSES-BASED • EASY TO USE WIDGETS• WYSIWYG WORKSHOP • FREE SDK
MYTUI Logo

APIs for Label Widget

CONTENT

1.1. Introduction 1

1.1.1. Look & Feel 1

1.1.2. Key Bindings 2

1.1.3. Callbacks 2

1.2. Attributes 2

1.2.1. Label Name 2

1.2.2. Position 2

1.2.3. Label Text 2

1.2.4. Display Length 2

1.2.5. Text Attribute 2

1.2.6. Text Alignment 3

1.2.7. Hide Flag 3

1.3. Methods (in alphabetic order) 3

1.3.1. MYLABELprintf: set the label text with the formatted string 3

1.3.2. MYLABELsetAlign: set text alignment for the label 3

1.3.3. MYLABELsetAttrib: set label text¡¯s display attribute 4

1.3.4. MYLABELsetDispLength: set display length for the label 4

1.3.5. MYLABELsetInvisible: hide the label from the form window 4

1.3.6. MYLABELsetPos: set label¡¯s position within the form window 4

1.3.7. MYLABELsetText: set the label¡¯s text 5

1.3.8. MYLABELsetVisible: make the label visible 5

 

1.1. Introduction

The Label widget is used for displaying static plain text. It is rather simple, no user interaction functionality is provided. It is often used as a label for an interactive widget.

1.1.1. Look & Feel

The figure below shows three different style label widgets:

1.1.2. Key Bindings

No key bindings defined for label widget since it is non-interactive.

1.1.3. Callbacks

No callback functions defined for label widget since it is non-interactive.

1.2. Attributes

1.2.1. Label Name

Each label widget must have a unique name within its father form to differentiate it from other widgets. It must be assigned when created with method MYWINnewObj(). Though it can be renamed by routine MYWINsetObjName(), we don¡¯t recommend to do so since the name is the only element used to get the widget¡¯s handle at runtime.

Note: the length of the name is limited to 32 bytes.

1.2.2. Position

The relative position (Y, X) or (Row, Col) to the upper left corner of the form window¡¯s work area where:

Y (Row): Vertical position of the label

X (Col): Horizontal position of the label

They are based from a start point of (0,0). They can be set with method MYLABELsetPos().

1.2.3. Label Text

The label¡¯s content. The text length is limited to 80 bytes otherwise it will be truncated.

The default text is ¡°label¡±. It can be set with method MYLABELsetText() or MYLABELprintf().

1.2.4. Display Length

It is the actual display area for the label text. If it is less than the length of the text, only part of the text will be displayed (also depends on Text Alignment).

The display length is limited to the actual width of the form window's work area. So it will not always be what you have expected. It might be adjusted to fit the work area's size.

The default value is the length of initial text (¡°label¡±), that is, 5 bytes. It can be set with method MYLABELsetDispLength().

1.2.5. Text Attribute

The display attribute of the label. It can either be one of the following attributes or the combination of them (they are defined in <curses.h>):

A_NORMAL        Normal display (no highlight)

A_STANDOUT      Best highlighting mode of the terminal.

A_UNDERLINE     Underlining

A_REVERSE       Reverse video

A_BLINK         Blinking

A_DIM           Half bright

A_BOLD          Extra bright or bold

A_PROTECT       Protected mode

A_INVIS         Invisible or blank mode

Where A_NORMAL, A_UNDERLINE, A_REVERSE are the most frequently used attributes with A_NORMAL being the default value. It can be set with method MYLABELsetAttrib().

1.2.6. Text Alignment

The alignment attribute of the text within thelabel. There are three options available:

ALIGN_LEFT: text is left-aligned within the label

ALIGN_CENTER: text is centered within the label.

ALIGN_RIGHT: text is right-aligned within the label.

ALIGN_LEFT is the default value. It can be set with method MYLABELsetAlign().

1.2.7. Hide Flag

This attribute controls the visibility of the label on the form window. It can be set with method MYLABELsetVisible() and MYLABELsetInvisible().

 

1.3. Methods (in alphabetic order)

1.3.1. MYLABELprintf: set the label text with the formatted string

The prototype is:

int  MYLABELprintf( long Hwin, long Hobj, char *format, ... );

It sets the label text according to the specified format. Hwin is the handle of the form window, Hobj is the handle of the label widget and format string specifies how subsequent arguments are converted for the text. Refer to the standard C function printf() for details of format.

It is delivered to replace function MYLABELsetText() in the more flexible way and save codes for you.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().

Note1: Any control characters, carriage return/line feed characters and tab characters in the string will be replaced with spaces.

Note2: This function is available only from MYTUI1.2 or high version.

1.3.2. MYLABELsetAlign: set text alignment for the label

The prototype is:

int  MYLABELsetAlign( long Hwin, long Hobj, int Align );

It sets the aligning mode for the label text. Hwin refers to the form window, Hobj refers to the label and Align specifies the aligning mode. See also Text Alignment attribute.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().

Note: this routine should be called before calling MYWINdraw().

1.3.3. MYLABELsetAttrib: set label text¡¯s display attribute

The prototype is:

int  MYLABELsetAttrib( long Hwin, long Hobj, int Attrib );

It sets the display attribute for the label text where Hwin refers to the form window, Hobj refers to the label and Attrib is the display attribute to be set. See also Text Attribute for details.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().

Note: this routine should be called before calling MYWINdraw().

1.3.4. MYLABELsetDispLength: set display length for the label

The prototype is:

int  MYLABELsetDispLength( long Hwin, long Hobj, int Length );

It sets the display length for the label. Hwin is the handle of the form window, Hobj is the handle of the label and Length specifies the length to be set. See also Display Length for details.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().

Note: this routine should be called before calling MYWINdraw().

1.3.5. MYLABELsetInvisible: hide the label from the form window

The prototype is:

int  MYLABELsetInvisible( long Hwin, long Hobj );

It hides the label from the form window, that is, make it invisible. Hwin refers to the form window and Hobj refers to the label to be hidden.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().

1.3.6. MYLABELsetPos: set label¡¯s position within the form window

The prototype is:

int  MYLABELsetPos(  long Hwin, long Hobj, int Y, int X);

It sets the label¡¯s relative position to the form window¡¯s work area. Hwin refers to the form window, Hobj refers to the label and (Y, X) is the position to be set. Refer to Position for the description of position.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().

Note1: it should be issued before calling MYWINdraw().

Note2: The actual values will not always be what you have input. They might be adjusted to fit the form window¡¯s size.

1.3.7. MYLABELsetText: set the label¡¯s text

The prototype is:

int  MYLABELsetText( long Hwin, long Hobj, char *Text );

It sets the label text. Hwin refers to the form window, Hobj refers to the label widget and Text is the string to be set. See also Label Text.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().

Note: Any control characters, carriage return/line feed characters and tab characters in the string will be replaced with spaces.

1.3.8. MYLABELsetVisible: make the label visible

The prototype is:

int  MYLABELsetVisible( long Hwin, long Hobj );

It makes the label visible again if it is hidden from the user. Hwin refers to the form window and Hobj refers to the label. See also Hide Flag.

Zero is returned upon successful completion, otherwise a non-zero integer is returned from which more information can be retrieved by application mytuierr or routine MYTUIgetErrMsgByCode().


Rated by 5 points award on download ready Best Vista Downloads Qwerks - Software and Space Guns