[WJG] (31/Dec/09) Loading a glade file into Gnocl is fine, but what if its necessary to compile the script using FreeWrap?
What is the simplest way of encapsulating the glade XML code into the package? As can be seen from the
example below, a glade XML UI file can be included as a simple string and then implemented using the gnocl::glade buffer command.
======
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
package require Gnocl
#---------------
# Create a simple layout, a widget with a button.
#---------------
set gladeBuffer {
GTK_WIN_POS_CENTER
300
100
True
True
True
Close Me!
0
}
#---------------
# Load the buffer.
#---------------
set glade1_widgets [gnocl::glade buffer $gladeBuffer]
#---------------
# Register the widgets using their glade names.
#---------------
foreach item $glade1_widgets {
foreach {gnocl glade} $item {}
set $glade $gnocl
}
#---------------
# Tweak settings, and display.
#---------------
$button1 configure -onClicked {gnocl::beep}
$window1 show -onDestroy {exit}
gnocl::mainLoop
======
<> Uncategorized