Monday, November 01, 2010

gnocl::infoBar -done!

Well, lets say 85% done. Enough for now anyway. This is a 'querky' sort of widget. The docs say:

GtkInfoBar is a widget that can be used to show messages to the user without showing a dialog. It is often temporarily shown at the top or bottom of a document. In contrast to GtkDialog, which has a horizontal action area at the bottom, GtkInfoBar has a vertical action area at the side.

Well. here's a screenshot and test script:



#---------------
# test-infobar.tcl
#---------------
# William J Giddings
# 01-Nov-2010
#---------------

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

package require Gnocl

set ib [gnocl::infoBar]

$ib configure -onResponse {
        switch -- %d \
            $but(OK)      {puts "You clicked the OK button."} \
            $but(CANCEL) {puts "You clicked the CANCEL button."} \
            default      {puts "You clicked something else!"}
         }

puts "$ib is a widget class: [$ib class]"

set box [gnocl::box]
set lab [gnocl::label -text "Add Extra Items Here!"]

$box add $lab -fill {1 0} -expand 1
$ib configure -child $box ;#-type info

set but(OK) [$ib add button OK]
set but(CANCEL) [$ib add button Cancel]

$ib configure -default 2

set txt [gnocl::text]
set frame [gnocl::box -orientation vertical]

$frame add $txt -fill {1 1} -expand 1
$frame add $ib

gnocl::window -child $frame

No comments: