PtLabel

PtLabel — A label that displays text, bitmaps, or images.

Synopsis

class PtLabel PtBasic
{
    accel_key;               // string  (Pt_ARG_ACCEL_KEY)    
    balloon_color;           // color  (Pt_ARG_BALLOON_COLOR)    
    balloon_fill_color;      // color  (Pt_ARG_BALLOON_FILL_COLOR)    
    balloon_position;        // short  (Pt_ARG_BALLOON_POSITION)    
    horizontal_alignment;    // unsigned char  (Pt_ARG_HORIZONTAL_ALIGNMENT)    
    label_data;              // PhImage  (Pt_ARG_LABEL_DATA)    
    label_flags;             // flag  (Pt_ARG_LABEL_FLAGS)    
    label_type;              // char  (Pt_ARG_LABEL_TYPE)    
    line_spacing;            // unsigned short  (Pt_ARG_LINE_SPACING)    
    margin_bottom;           // unsigned short  (Pt_ARG_MARGIN_BOTTOM)    
    margin_left;             // unsigned short  (Pt_ARG_MARGIN_LEFT)    
    margin_right;            // unsigned short  (Pt_ARG_MARGIN_RIGHT)    
    margin_top;              // unsigned short  (Pt_ARG_MARGIN_TOP)    
    select_shift;            // unsigned short  (Pt_ARG_SELECT_SHIFT)    
    text_font;               // string  (Pt_ARG_TEXT_FONT)    
    text_string;             // string  (Pt_ARG_TEXT_STRING)    
    underline1;              // color  (Pt_ARG_UNDERLINE1)    
    underline2;              // color  (Pt_ARG_UNDERLINE2)    
    underline_type;          // unsigned short  (Pt_ARG_UNDERLINE_TYPE)    
    vertical_alignment;      // unsigned char  (Pt_ARG_VERTICAL_ALIGNMENT)    
}
		

Base Classes

PtWidget <-- PtBasic <-- PtLabel

Derived Classes

PtButton, PtMenuLabel, PtText, PtToggleButton

Description

This widget is a label that can hold text, bitmaps, or images, and has an optional pop-up text balloon. Labels can be used to identify widgets and data entry fields, make icons, or put pictures into your applications.

[Note]

For detailed information, please refer to PtLabel in the Photon documentation.

Instance Variables

accel_key

A string specifying a character to use as an accelerator key or hot key.

balloon_color

A number specifying the color for pop-up balloon text. Default is 0x0 (black).

balloon_fill_color

A number specifying the color for the pop-up balloon background. Default is 0xfeffb1 (yellow).

balloon_position

This instance variable specifies the position of the pop-up balloon, and may have one of the following values:

ConstantDescription
Pt_BALLOON_RIGHTRight
Pt_BALLOON_LEFTLeft
Pt_BALLOON_TOPTop
Pt_BALLOON_BOTTOMBottom
Pt_BALLOON_INPLACEIn Place

horizontal_alignment

This instance variable specifies the horizontal alignment of the label text, and may have one of the following values:

ConstantDescription
Pt_RIGHTAlign the label text to the right.
Pt_LEFTAlign the label text to the left.
Pt_CENTERCenter the label text horizontally.

label_data

A PhImage displayed by the label if the label_type is set to Pt_IMAGE.

label_flags

This instance variable controls the appearance and behavior of the widget, and may be a combination of zero or more of the following flags:

ConstantDescription
Pt_LABEL_SELECT_SHIFTCause the content of the widget to shift down and right when the widget is selected.
Pt_SHOW_BALLOONCause balloon help to pop up on the widget if the cursor is left stationary over the widget for 1.25 seconds.
Pt_BALLOON_AS_REQUIREDOnly show balloon help if it is different from the visible content of the widget.
Pt_BACKFILL_TEXTCause the widget to fill the text rectangle with the background color before rendering the text.
Pt_BALLOON_REGISTEREDInternal informational bit.

label_type

This instance variable specifies the type of label, and may have one of the following values:

ConstantDescription
Pt_Z_STRINGDisplay text using the text_string variable.
Pt_BITMAPBitmap
Pt_IMAGEDisplay a PhImage using the label_data variable.
Pt_TEXT_IMAGEDisplay text and an image, positioned by the balloon_position variable.

line_spacing

A number of pixels to put between lines of text for extra space.

margin_bottom, margin_left, margin_right, margin_top

A number of pixels on the bottom, left, right, and top between the text and the edge of the label for margins.

select_shift

This instance variable is deprecated. Set the Pt_LABEL_SELECT_SHIFT flag in label_flags instead.

text_font

A string specifying the font used for label text.

text_string

The string used for the label text string if the label_type is set to Pt_Z_STRING or Pt_TEXT_IMAGE.

underline1

A number specifying the color for the first underline. Default is 0x0 (black).

underline2

A number specifying the color for the second underline, which is just below the first underline. Making the two the same color creates a thick underline. Default is 0xffffffff (transparent).

underline_type

A constant that specifies the type of underline for the text. For single or double underlines, the underline colors are specified using underline1 and underline2 (above). Etched underlines use the colors of the widget's top_border_color and bot_border_color.

This instance variable may have one of the following values:

ConstantDescription
Pt_NO_ULINEText is not underlined.
Pt_SINGLE_ULINEText gets a singe underline.
Pt_DOUBLE_ULINEText gets a double underline.
Pt_ULINE_ETCHED_INThe underline gets an 'etched-in' appearance.
Pt_ULINE_ETCHED_OUTThe underline gets an 'etched-out' appearance.

vertical_alignment

This instance variable determines the vertical alignment of the text string, and may have one of the following values:

ConstantDescription
Pt_BOTTOMAlign the label text to the bottom.
Pt_TOPAlign the label text to the top.
Pt_CENTERCenter the label text vertically.