Documentation‎ > ‎Containers‎ > ‎

    gnocl::fixed

    A widget which allows widgets to be placed at exact locations in a window.


    Synopsis

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

    Screenshot

    Options

    -x [int]
    Horizontal position of the widget within the parent container in pixels (default = 0). 
    -y [int]
    Vertical position of the widget within the parent container in pixels (default = 0). 
    -width [int]
    Specify the width of widget in pixels. If this value is not given, then the size will be automatically allocated based upon the content of widget. 
    -height [int]
    Specify the height of widget in pixels. If this value is not given, then the size will be automatically allocated based upon the content of widget. 
    -child widget-ID (default: "")
    Widget id of item to be placed in the widget.

    Description

    This widget allows the specific placement of widgets within a container. If the container is resized, the child widgets retain their allocated positions and sized.

    NOTE: If the contents of the child widgets changes, there is no guarentee that the child widget will be automatically resized to accomodate the display of it contents.

    Commands

    id delete
    Deletes the widget and the associated tcl command. id add <widget-id> [-option value...]
    Adds the <widget-id> as child within the fixed container.
    Options
        -x [int]
    Horizontal position of the widget within the parent container in pixels (default = 0). 
        -y [int]
    Vertical position of the widget within the parent container in pixels (default = 0). 
        -width [int]
    Specify the width of widget in pixels. If this value is not given, then the size will be automatically allocated based upon the content of widget. 
        -height [int]
    Specify the height of widget in pixels. If this value is not given, then the size will be automatically allocated based upon the content of widget. 
    id children
    Retutrns a list containing the names of all children belonging to the gnocl:fixed container.
    id class
    Returns the class of this object, i.e. "fixed".
    id raise <child-widget>
    Raise the specified child widget up one level in the z-stacking order. If the new level is higher than the topmost layer, then the specified object will be set at the topmost position.
    id lower <child-widget>
    Lower the specified child widget up one level in the z-stacking order. If the new level is lower than the lowest layer, then the specified object will be set at the lowest position.
    id toBottom <child-widget>
    Lower the specified child to the lowest level in the z-stacking order, i.e. render first.
    id toTop <child-widget>
    Raise the specified child to the highest in the z-stacking order, i.e. render last.
    id toTop <child-widget>
    Raise the specified child to the highest in the z-stacking order, i.e. render last.
    id stackLevel <child-widget> <level>
    Move the specified child to the level in the z-stacking order specified by <level>.
    id move <child-widget>  [-option value...]
    Relocate and/or resize a child widget .
    Options
        -x [int]
    Horizontal position of the widget within the parent container in pixels (default = 0). 
        -y [int]
    Vertical position of the widget within the parent container in pixels (default = 0). 
        -width [int]
    Specify the width of widget in pixels. If this value is not given, then the size will be automatically allocated based upon the content of widget. 
        -height [int]
    Specify the height of widget in pixels. If this value is not given, then the size will be automatically allocated based upon the content of widget. 
    id remove <child-widget>
    Remove a widget from the gnoc::fixed container. This does not delete the <child-widget> which can now be reparented as necessary.

    Example

    # basic Tcl/Gnocl Script
    #!/bin/sh \
    exec tclsh "$0" "$@"
    package require Gnocl

    set but(1) 10
    set but(2) 30
    set but(3) 50
    set but(4) 70

    set but1 [gnocl::button -text "APPLE"]
    set but2 [gnocl::button -text "BANANA"]
    set but3 [gnocl::button -text "CHERRY"]
    set but4 [gnocl::button -text "DAMSON"]

    set lab [gnocl::label ]

    set fx [gnocl::fixed ]
    gnocl::window -child $fx -width 200 -height 130

    $fx add $but1 -x $but(1) -y 10 -width 80 -height 40
    $fx add $but2 -x $but(2) -y 30 -width 80 -height 40
    $fx add $but3 -x $but(3) -y 50 -width 80 -height 40
    $fx add $but4 -x $but(4) -y 70 -width 80 -height 40

    $but1 configure -onClicked {
    if {$but(1) == 10} {set but(1) 110} else {set but(1) 10}
    $fx toTop %w
    $fx move %w -x $but(1) -y 10 -width 80 -height 40
    puts [$fx children ]
    }

    $but2 configure -onClicked {
    if {$but(2) == 30} {set but(2) 110} else {set but(2) 30}
    $fx toBottom %w
    $fx move %w -x $but(2) -y 30 -width 80 -height 40
    puts [$fx children ]
    }

    $but3 configure -onClicked {
    if {$but(3) == 50} {set but(3) 110} else {set but(3) 50}
    $fx lower %w
    $fx move %w -x $but(3) -y 50 -width 80 -height 40
    puts [$fx children ]
    }

    $but4 configure -onClicked {
    if {$but(4) == 70} {set but(4) 110} else {set but(4) 70}
    $fx move %w -x $but(4) -y 70 -width 80 -height 40
    $fx raise %w
    }

    foreach item [$fx children ] {
    #$fx move $item -x 0 -y 0
    }

    puts size=[$fx size $but3 ]
    puts position=[$fx position $but3 ]

    gnocl::mainLoop

    Comments

    Sections