Skip to main content

Summary of Recent Progress

The current nightly build sees a range of enacements to Gnocl as a whole. A number of issues have been addressed as itemized in the extract from the NEWS document below. This nightly update sees the -name option taking on a greater role in the control of widgets. Ordinarily used for specifying ojects in a Gtk CSS file, or in a builder/glade XML file, using the name option will cause the interpretor to create a command for the widget using the string specified by the -name option. Ordinarily a widget instance would be created as follows:

set myButton [gnocl::button -text "Hello World"]

And modified with:

$myButton configure -onClicked { puts %w }

But now,  the following will produce similar results.

gnocl::button -text "Hell World" -name myButton

Modification can also be handled too,

myButton configure -onClicked {puts %w}

This approach provides a neat and efficient way of creating widgets as objects within namespaces. Using the same example the following could be used:

gnocl::button -text "Hell World" -name myprocs::myButton

The creation of widget with command names in this way does not eliminate the process of registering widgets with a unique id. Using the same example, to access this simply use:

[myprocs::myButton]

and the widget id will be returned.

Substitution strings also unclude the %g and %w parameters to extract the (glade) name and w(idget-id) of the object.

New Extract

2015-05:
    gnocl::notebook
        o added extra percentage subtitution strings to -onPageAdded, -onPageRemoved
                %l page label
    gnocl::comboBox/comboEntry added new sub-commands: get, set, prepend, append, insert and remove.
    gnocl::box/hBox/vBox fixed problem with cget -children
    gnocl::window, gnocl::expander, gnocl::fontSelection, gnocl::gammaCurve,
    gnocl::curve, gnocl::handleBox, gnocl::level, gnocl::popupEntry, gnocl::recentChooser
        o added -name
  

Comments

vallinayagam said…
Hi, I want to have gnocl compiled with gtk3. gtk3 provides the flexibility of having web-backend using broadway. Meaning the widgets are rendered in a browser. It is a easier way to have web based tcl app. The present gnocl is compiled with gtk2. Can you help me in that migration.

Regards
Valli
Hi Valli

Gtk3+ offers a host of great new features which aren't available in Gtk2+ and so the transition is relevant. However, with a package such as Gnocl, recompilation of the sources with the Gtk3+ libraries is not a simple matter and will effect the code at all levels. As you probably know already, many of the Gtk+ legacy widgets are abscent from Gtk3+, and many of the api calls have been deprecated. Whilst a Gtk3+ compliant version of Gnocl is desirable, it is not currently at the top of the priority list. I'm sorry that I can't be of much more help at this point in time.

However, if you do feel brave enough to attempt the basics of the transition, then I would be happy to collaborate. Bear in mind though, Gnocl a binding to the whole GTK library plus much more, its a lot of work and the API documentation is, at best, basic, and at worst useless!

If you have a single application in mind rather than creating a complete language binding, then one solution would be to create a custom Tcl application package into which you could build in a TCL API to only those widgets you need. There are plenty of details on package building on the Tcler's wiki. Once you've created a loadable package, at that point you could introduce code from the Gnocl main modules and work around any differences between GTK3+ and GTK2+ as you go. One possible additional benefit would be that your code overhead could be streamlined and fitted to your application requirements.

Best Wishes

WJG

Popular posts from this blog

gnocl::calendar

Given this module some attention today. Added some of the more package wide options to the module and created customised handler for setting the month. (For some odd reason months are are counted 0-11 whereas days are 1-31.) There's still a little more to do to this one including the addition of code to store diary details. Here's the working test script to show the range of options at work. The percentage substitution string item %e explores something that I've been toying with, the name of the signal/event that initiated the call. Ok, a script can keep its own internal trace but who knows, it might prove useful. #--------------- # calendarTest.tcl #--------------- # Author:   William J Giddings # Date:     07/05/09 #--------------- #!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" #--------------- package require Gnocl set cal [gnocl::calendar] $cal configure -day 8 -month 7 -year 1956 $cal configure -rowHeight 1 -colWidth 1 $ca

Gnocl Dashboard

Over the past few programming sessions I've been working on producing a central point, a dashboard, around which it's possible to see the various Gnocl widgets and commands in operation. In many ways like the demo script which shipped with the earlier releases of Gnocl but offers much more. The introspection functionality provides details of the various options and sub-commands of each Gnocl procedure which are displayed under the associated tab. Sample scripts are included for each item which offers newcomers a clearer insight into how make the most of what's on offer.

Simple Runtime Debugging Message Dialog

At times it's useful to see what values variables hold, or offer some pause point before the code goes elsewhere before causing havoc. Its possible to write output to the terminal but this can get lost in copious forms of other outputs, besides, there's no pausing the script execution either. The following proc creates a custom dialog which displays ad message along with the point in the calling script from which it was invoked. ## simple runtime debugging feedback dialog, alternative to console based gnocl::msg # @param msg message to display # @returns none # proc xxx::msg {txt} { set frame [info frame -1] append msg "Message:\n\n" append msg " $txt \n\n\n" append msg "Called from:\n\n" append msg "Proc:\t[lindex [info level -1] 0]\n" append msg "File:\t[file tail [dict get $frame file]]\n" append msg "Line:\t[dict get $frame line]\n" gnocl::dialog \ -type info \ -text $msg