Documentation‎ > ‎Display‎ > ‎

    gnocl::label

    A widget which shows a small amount of text.

    Synopsis

    gnocl::label [-option value...]

    Screenshot

    Options

    -align one of topLeft, top, topRight, left, center, right, bottomLeft, bottom, or bottomRight
    Alignment of the text.
    -data string
    User defined data which can be retrieved via the cget subcommand.
    -heightGroup string (default: "")
    The -heightGroup option can be an arbitrary string. All widgets with the same heightGroup request the same height. If packed with the fill flag set, they will have nevertheless different heights.
    -justify one of left, right, center or fill (default: left)
    Determines the justification of the text lines. Has no effect if the label has only one line of text.
    -maxWidthChars integer
    The maximum size of the widget in characters.
    -mnemonicText string (default: "")
    The first underlined character represents a keyboard accelerator called a mnemonic. The mnemonic key can be used to activate another widget set using the -mnemonicWidget option.
    -mnemonicWidget Wiget-ID (default: "")
    Widget which is activated for when mnemonic sequence activated..
    -resizable boolean (default: 0)
    Whether or not the item can be resized within its container.
    -selectable boolean (default: 0)
    Whether the text can be selected.
    -sensitive boolean (default: 1)
    Whether or not the item is sensitive to user input.
    -sizeGroup string (default: "")
    The -sizeGroup option can be an arbitrary string. All widgets with the same -sizeGroup request the same size. If packed with the fill flag set, they will have nevertheless different sizes.
    -text percent-string (default: "")
    Text of the label.
    -textVariable string (default: "")
    The name of a global variable which is changed whenever the label text is changed
    -visible boolean (default: 1)
    Whether or not the item is visible.
    -widthGroup string (default: "")
    The -widthGroup option can be an arbitrary string. All widgets with the same -widthGroup request the same width. If packed with the fill flag set, they will have nevertheless different widths.
    -widthChars integer
    Size of the widget in characters.
    This option is available since GTK+ 2.6.0
    -wrap boolean (default: 0)
    Whether the text should be automatically wrapped.
    -xPad integer (default: 0)
    Horizontal padding.
    -yPad integer (default: 0)
    Vertical padding.

    Description

    A label displays a small to medium amount of text. With the help of embedded markup commands the text inside a label can even have different fonts, colours etc.

    Commands

    id cget option
    Returns the value for one option. The option may have any of the values accepted by configure.
    id class
    Return the class for this widget object, i.e. 'label'.
    id configure [-option value...]
    Configures the widget. Option may have any of the values accepted on creation of the widget.
    id delete
    Deletes the widget and the associated tcl command.

    Example

    #---------------
    # test-mnemonic.tcl
    #---------------
    #!/bin/sh
    #\
    exec tclsh "$0" "$@"

    package require Gnocl

    set str(1) ""
    set str(2) ""
    set str(3) ""


    #---------------
    #
    #---------------
    proc labelEntry {str var} {
        upvar $var v
        puts $v
        set box [gnocl::box]
        set ent [gnocl::entry -sizeGroup a -variable $var]
        set lab [gnocl::label -align right -widthGroup aa -mnemonicText $str -mnemonicWidget $ent]
        $box add $lab
        $box add $ent
        return $box
    }

    #---------------
    #
    #---------------
    proc form {} {
        global str

        set box [gnocl::box -orientation vertical]

        $box add [gnocl::label \
            -text {%<<span foreground="blue">Contact</span> <span foreground="red">Details</span>} \
            -textVariable tmp]

        $box add [labelEntry %<<b>_Name</b> str(1) ]
        $box add [labelEntry _Address str(2) ]
        $box add [labelEntry _Phone str(3) ]

        gnocl::dialog \
            -child $box \
            -setSize 0.125 \
            -onResponse {
                parray str
            }
    }

    form
    Comments

    Sections