Showing posts from 2019

Recent Changes, October 2019

The past few weeks has offered me the opportunity to scan through the Gnocl code base and to do some much needed maintance.  There's still much to do, but here's a summary of the past month's efforts.

        o this is a very widget, unecessary functions removed.
        o deprecated items removed
          substitution string %a now works correctly
   gnocl::fileSelection (deprecated widget)
        o bugs fixed
        o command onChanged renamed to changed.
        o added options: -visible, -tooltip, -sensitive, -name, and -data.
        o added -tooltip, -onColorChanged, -palette
        o added cget
        o added commands, options, commands
        o timeout now cancels when widget destroyed.
        o added commands insertPage, appendPage, prependPage
           o bug fix: load -file, will no longer crash …

Serialize/Deserialize a Gnocl Tree Widget

The options and command set of the gnocl::tree widget allow for easy creation and editing of data arranged and displayed in a tree structure. What is lacking in the Gtk api is an equivalent of the GtkTreeView serialize and deserialize functionality.

Creating a similar offering for the gnocl::tree is not altogether difficult to implement because it is possible to sequentially extract data from a tree which can then be saved for later use (serialize). When the data is next needed for use, it can be sequentially added to a new tree widget (deserialize).

The sampe code below will produce the following,  the tree on the left is created through the direct addtion of data, whereas the tree on the right (with treelines) is created by deserializing the data set of the first tree.

When data contained in a tree was serialzed the following list was returned and save to disk. Each line of list represents a row in the tree where the first item is the node path, and the second item, the data itself…

Cloning a Gnocl Widget Made Simple

A while ago I saw a StackoverFlow request about cloning widgets. Ok, the request was about cloning Gtk widgets in C, but here's the solution in Tcl using the Gnocl package. For a some time now its been possible to query the Gnocl package about the various options and commands available to each widget and its this ability combined with the cget (configuration get) command that allows property and data values to be extracted from a widget. Here's a very simple example based upon a button. 

# the next line restarts using tclsh \
exec tclsh "$0" "$@"

if { [catch { package present Gnocl } ] } { package require Gnocl }

## clone specified widget
#/param    wid the widget to clone
#/returns   wid of newly created clone object
proc gnocl::clone { wid } {

        foreach item [split [string trim [gnocl::[$wid class] options]] \n] {
                # get list of options from internal help,
                # trim away option information
                set item …

Recent Changes. September 2019.

Just a few enhancements to the code this month.

        o new option -title

  gnocl::labelEntry, gnocl::labelText, gnocl::labelWidget
        o new option -orientation

        o -geometry, list of four integers x, y, width, height.
        o cget -geometry returns same values as command geometry

        o cget -baseColor now returns correct value.

Recent Changes. June 2019.

Spent most of my available time Tcl coding during June, none the less, a couple of bug fixes sorted out.

        o fixed buffer overflow bug in the 'tag ranges' subcommand.
        o fixed bug in "tag properties" commmand, now returns correct values for -foreground, -background, -fontRise, -rise and -font.

Recent Changes. May 2019.

Some minor but useful changes and additions.

    drag and drop operations
        o -onDropData substitution string %d (data) now reassigned to %D,
          %d will now be replaced by widget data assigned by the -data option.
        o new options -primaryIconTooltip and -secondaryIconTooltip.
        o cget -baseColor now works.
        o new options -onDragData, -onDropData and -afterDropData.
        o on activiation empty strings are no longer added to the dropdown list.
        o problem fixed with %d substitution within -onChanged event commands.
        o Now defaults to -wrapMode word.

Recent Changes, April 2019

How time flies! I knew that I hadn't made one of this blog posts for some time but, didn't think that it such a long time ago. Well, some enhancements to the core modules has taken place although not too many.  In a nutshell a couple of bug fixes and some enhancements to a few widget options. As usual latest code available from SourceForge.

        o new commands push/pull, synonyms for set and get, when label used as simpler status bar.
        o -onSelection will now be respond to selections made via the keyboard.
        o %d substitution string implemented for -onFileSet callbacks.
        o renamed onChanged command to changed.
        o problems with -onPopup and -onPopulateMenu options now fixed.       
        o new command clear, resets file selection to 'none'.
        o added -fileName (include full path in utf8)