Documentation‎ > ‎Containers‎ > ‎

    gnocl::layout

    A widget that produces an scrollable area into which widgets can be embedded and custom drawing done.

    Synopsis

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

    Screenshot


    Options

    -hadjustment string

    NOTE: Not yet implemented.
    -vadjustment string
    NOTE: Not yet implemented.
    -width integer (default: 100)

    The width of the layout in pixels.
    -height integer (default: 100)
    The height of the layout in pixels.
    -onScrollAdjustment string (default: "")
    Tcl script which is executed if set-scroll-adjustment signal is emitted. Before evaluation the following percent strings are substituted:

    %w    widget name

    NOTE:

    More substitution strings are to be added.
    -tooltip string (default: "")

    Message that appear next to this widget when the mouse pointer is held over it for a short amount of time.
    -data  string (default: "")
    User defined data which can be retrieved via the cget subcommand.
    -onShowHelp string (default: "")
    Tcl command which is executed in the global scope if the "show-help" signal is received, which is normally the case if the user presses F1 or Ctrl-F1. Before evaluation the following percent strings are substituted:

    %w   widget name
    %h   help type: either "whatsThis" or "tooltip" 
    -cursor  string (default: "")
    User defined data which can be retrieved via the cget subcommand.
    -sensitive boolean (default: 1)
    Whether or not the item is sensitive to user input.
    -visible boolean (default: 1)
    Whether or not the item is visible.

    Description

    The Gnome desktop has a "system tray" which functions as notification area and generally contains transient icons that indicate some special state. For example, a system tray icon would be displayed to notify the user that they have received new mail or an incoming instant message. 

    NOTE:

    Reference to the Gtk+ documentation will describe this object as a Gtk+ Display widget. As this item relies upon resource not contained within the core Gtl+ intallation and may not be a cross-plaform feature, it this item is contained with the GnoclGnome package.

    Commands

    id cget option

    Returns the value for the specified option. The option may have any of hte values accepted by configure.

    id class

    Returns the class of the widget, i.e. statusIcon.

    id configure [-option value...]

    Configures the widget. Option may have any of the values accepted on creation of the widget.

    id add widget-id [-option value...]

    Add child widget specified by widget-id to the frame.

    Options

    -x integer (default: 0)

    Horizontal placement of the widget within the layout scrollable area.

    -y integer (default: 0)

    Vertical placement of the widget within the layout scrollable area.

    id move widget-id [-option value...]

    Move child widget specified by widget-id to a new position within the layout scrollable area.

    Options

    -x integer (default: 0)

    Horizontal placement of the widget within the layout scrollable area.

    -y integer (default: 0)

    Vertical placement of the widget within the layout scrollable area.

    id remove widget-id

    Remove the widget specified by widget-id from the list of child widgets contained within the layout..
    id delete
    Deletes the layout widget and the associated tcl command and all child widgets.

    Example

    #---------------
    # test-layout.tcl
    #---------------
    # William J Giddings
    # 04-Nov-2010
    #---------------

    #!/bin/sh
    # the next line restarts using tclsh \
    exec tclsh "$0" "$@"

    package require Gnocl

    set lo [gnocl::layout -width 500 -height 4000]

    set but1 [gnocl::button -text "Button"]
    set but2 [gnocl::button -text "DEL"]
    set but3 [gnocl::button -text "ADD" -sensitive 0]

    set x 10

    $lo add $but1 -x $x -y 10
    $but1 configure -onClicked {$lo move %w -x [incr x 10] -y 10}

    $lo add $but2 -x $x -y 50
    $but2 configure -onClicked {
        $lo remove $but1
        %w configure -sensitive 0
        $but3 configure -sensitive 1
        set x 10
        }

    $lo add $but3 -x [expr $x + 50]  -y 50
    $but3 configure -onClicked {
        $lo add $but1 -x $x -y 10
        %w configure -sensitive 0
        $but2 configure -sensitive 1
        }

    # add some more widgets
    set j 100
    for {set i 1} {$i<=100} {incr i} {
        $lo add [gnocl::button -text "Button-${i}a"] -x 10 -y $j
        $lo add [gnocl::button -text "Button-${i}b"] -x 90 -y $j
        incr j 30
    }

    gnocl::window \
        -child $lo \
        -widthRequest 200 \
        -heightRequest 300

    gnocl::mainLoop

    Comments

    Sections