Friday, August 28, 2020

August News

A bit late, but a couple of updates in July. The text search applying to whole words may present some issues where pattern matching on sub-strings was used. A later version may see the introduction of a -subString option.

 2020-07:
    gnocl::label
        o new options: -editable, boolean. Use in conjunction with the edit command.
         -onEnter, -onLeave, allows reaction to potential label rollover effects.
    gnocl::text
        o search will now ignore word embedded search patterns, i.e. search whole word only.

Monday, July 20, 2020

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.

June News


Just a few updates and resolutions with the sources.


2020-06:
    gnocl::spinButton
        o %d substitution now works with -onValueChanged
    gnocl::info
        o new sub-command, compileDate
          returns date and time when gnocl.so compiled
    gnocl::entry
        o added %t (text contents) and %v (validate command) to -onChanged -onKeyPress subsitutions strings
        o problems with undo/redo commands resolved
        o command listStack now returns entry undo/redo stack
    gnocl::tickerTape
        o start, stop and deleted commands now work properly
    gnocl::richTextToolBar
        o problems with delete command now resolved.

Friday, June 12, 2020

May News


Just a few enhancements and areas of work.


2020-05:
    gnocl::frame
        o option -labelAlign now takes two arguments, halign (default) and valign.
    gnocl::calendar
        o mark command now works correctly.
    gnocl::printDialog
        o now loads and prints.
    gnocl::scrolledWindow
        o new options, -heightRequest, -widthRequest
    gnocl::toggleButton
        o issues with toggle command now fixed.
    gnocl::label
        o cget -baseFont now works

Friday, May 08, 2020

April Changes and Updates

A few useful little tweaks and changes. The most significant is the introduction of a number of settings and internal code modifications to allow for the use of multiple monitors.

2020-04:
    gnocl::pixBuf
        o commands screenshot, windshow and widgetshot now work correctly.
    gnocl::screenShot
        o new command
    gnocl::text
        o -onInsertText this GtkTextBuffer callback binding now supports %w, the widgetId of the textview assoicated with the buffer.
    gnocl::image
        o cget -image now returns path/name of the image file displayed.
    gnocl::eventBox
        o new option -onDoubleClick
    gnocl::layout
        o new option -background
    gnocl::screen
        o "screens" command renamed to nMonitors, now works properly.
        o "geometry" command returns a list of the geometries of all system monitors.
    gnocl::window
        o "centre" and "center" commands now accept new option -monitor, range 0 - n.
        o -resizeMode now works, options: parent, queue, immediate.

Monday, April 27, 2020

March 2020 News

A little late in the month with these postings, but here's a list of the module changes for March 2020.  

gnocl::text
        o new substition strings for -onInsert, %w (textview-id) and %b (bufferid)
        o new command getBuffer, return current buffer id.
 gnocl::textBuffer, problems with commands now fixed.
 gnocl::acceleratorGroup
        o new subsitutions strings %t (toplevel) and %f (input focus widget)
gnocl::tree/gnocl::list
        o new command: redraw
        o option -onMoveCursor now works correctly
        o option -treeLinePattern now works; options = dotted (default), solid or broken
        o new options: -focusIn, -focusOut, -onCursorChanged,
         -onButtonPress, -onButtonRelease, -onColumnsChanged,
         -onExpandCollapseCursorRow, -onRowActivated, -onSelectAll,
         -onSelectCursorParent, -onSelectCursorRow, -onSetScrollAdjustments,
         -onTestCollapseRow, -onTestExpandRow, -onToggleCursorRow,
         -onUnselectAll
 gnocl::toolbar
        o new options: -widthRequest, -heightRequest
 gnocl::notebook
        o new option: -backgroundColor
 gnocl::button
        o new options -orientation, -invert, -style
 gnocl::dialog
        o new option -decorated, create notification type dialogs

Sunday, March 15, 2020

List Row Colouration - Formatting a row of text in a list widget.



The way in which the tree and list widgets handle cell formatting is to emphasize data groups in the context a columns, and their background colouration. Specific cells are usually formatted based upon their contents, principally as foreground attributes although cell value contents can also be formatted using pango markup.


Row formatting in comparison is principally used for assisting visibility such as changing alternating row colour hinting and treeline. Selected rows are temporarily highlighted. Unlike the column configuration options Gtk+ offers no equivalent for setting rows attributes. To achieve this, each cell value needs to be reset and specific attributes assigned. The following example shows how to set the foreground colour for cells in the same row. 


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

#---------------
# create UI
#---------------
proc main {} {
set box [gnocl::box -orientation vertical]
set ::list [gnocl::list \
    -titles {"string" "string" "string" "string"} \
    -types {string string string string} ]
$box add $::list -fill {1 1} -expand 1
gnocl::window -child $box -setSize 0.25
$::list add {0 "list widget" -104 1.45} -singleRow 1
$::list add {1 "window box" 3350 9.58} -singleRow 1
$::list add {AAA BBB CCC DDD} -singleRow 1

$::list columnConfigure 1 -editable 1

}

main

proc colorRowInit {wid {from 0} {to end}} {
    global _activeRow
    if { $to == "end" } { set to [$wid columns] }
    for { set i $from } { $i < $to } { incr i } { $wid columnConfigure $i -onCellData {setColor2 %w %p %v} }
    set _activeRow ""
       
    #---------------
    # change entry colour
    #---------------
    proc setColor2 { wid row val } {
        global _activeRow
        if { $row == $_activeRow } {
            return "-foreground red "
        } else {
            return "-foreground [list [$wid cget -textColor]] "
        }
    }
     gnocl::update
}
proc colorRow {wid row} {
    global _activeRow   
    set _activeRow $row
    for {set i 0} {$i < [$wid columns] } { incr i } {
        $wid cellConfigure $row $i -value [$wid get $row $i]
    }
    $wid draw
    gnocl::update
}


colorRowInit $list
set _activeRow 0
while 1 {
    after 1000
    colorRow $list $_activeRow
    
    if { [incr _activeRow] == [$list rows] } { set _activeRow 0 }
    
}


json_shell_utils.tcl