Monday, December 07, 2020

December News


 

 

 

 

 

Only a couple of updates to the code this month. 

 

 gnocl::toggleButton
 new option -iconSize, set to one of: menu, small, large, button, dnd or dialog.

gnocl::button
 -iconSize now works properly, set to one of: menu, small, large, button, dnd or dialog.

gnocl::image
 new command size, returns size of a valid image file.

gnocl::font renamed to gnocl::pangoFont
convert pango font string to valid Tcl tagged list.



Tuesday, November 03, 2020

gnocl::sticky - a minimal borderless window

 

Sometimes you just want to drop a small toolbar or widget holder on screen without all the decorations and controls. This code minimal minimal object is about as simple as it gets. 


proc gnocl::sticky { {orientation "horizontal"} } {
    if { [lsearch "vertical horizontal" $orientation] == -1 } { 
      return -code error \
      "Error! \"$orientation\" should be one of vertical or horizontal (default."  
    }   
    set box [gnocl::box -orientation $orientation \-borderWidth 0 -padding 0]
    set wid [gnocl::window -decorated 0 -child $box -height 25 -width 25]
    if { $orientation == "vertical"} { set tmp height} else {set tmp width}
    set eBox [gnocl::eventBox -borderWidth 0 -${tmp}Request 5 -background black]
    $eBox configure \
        -onButtonPress { %w configure -data "%x %y" -background red} \
        -onButtonRelease { %w configure -data "%x %y" -background black } \
        -onMotion { %t_ configure -x [expr %X - [lindex %d 0]] -y [expr %Y - [lindex %d 1]] }
    $box add $eBox -fill 1 -expand 0
    rename $wid ${wid}_
    # overload the basic window object
    proc $wid { cmd args } {      
        set wid [lindex [::info level 0] 0]   
        switch $cmd {
            remove -
            add { [${wid}_ cget -child] $cmd {*}$args }
            default { ${wid}_ $cmd {*}$args }
            }
    }
    return $wid
}

Sunday, November 01, 2020

October News


 

 

Just a few updates:


    gnocl::fixed
       o new option for move command, -align {x y} ; pair of floats (0-1.0) for positioning
    gnocl::pixBuf
       o new command getOrientation, returns either portrait or landscape
    gnocl::pointer
       o new command, get returns pointer screen x y coordinates
    gnocl::window
       o pointer command now has -screen option to return screen coordinates
    gnocl::toolBar
       o -iconSize and -style configure and cget fixed.
    gnocl::text
       o -shadow option now works properly (applied to scrolled window container).
       o search now has new option -wholeword <boolean> ; select between wholewords (1) and substring (0, default)
    gnocl::callback
        o new subcommands, prepend and append. Extend widget signal callback scripts.

Monday, October 19, 2020

September updates:


 

A  little late in the offering, but a few enhancements were made to the core options since the last posting.


2020-09:

gnocl::window
        o -icon option now recognizes %# (stock item) %/ (file) and %? (buffer) percent strings.


2020-08:
    gnocl::notebook
        o new command: getLabel
    gnocl::toolbar
        o new option: -widthGroup.

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 }
    
}


Thursday, March 12, 2020

gnocl::ribbon

I no longer use MS Windows but there is much talk of the "ribbon" widget used in MS products such as Word and Access. I originally came accross this type of layout many years ago when the MAYA 3D animation system was ported to Windows. Although it dominated the UI I could see its appeal and it mean that a lot of controls could be packed into a relatively small space. A ribbon bar, of course, is simply a megawidget with it children be compact versions of toobars, comboboxes and buttons.  Here a simple screen shot found on the web...














And here a protype gnocl quivalent. The ribbon bar itself is simply a horizontal box into which table widgets are added. The table can then be given a group id and a title. In the example below the ribbon is contained within a notebook page.


Tuesday, March 10, 2020

New button options -orientation, -invert

The default settings for the gnocl::button are for the icon to be on the left and the label on the right. Not all  buttons need to be like this. Consider the toolbar button where the icon in above the label. These new options offer the programmer a little more flexibility when building a UI using Gnocl, especially when creating ribbon type containers.

This is how the new settings look:











 And the sample code:


set hbox [gnocl::hBox]
   
set but1 [gnocl::button -text vertical -icon %#Info -data DATA -orientation vertical ]
set but2 [gnocl::button -text vertical-invert -icon %#Info -data DATA -orientation vertical -invert 1]
set but3 [gnocl::button -text horizontal -icon %#Info -data DATA ]
set but4 [gnocl::button -text horizontal-invert -icon %#Info -data DATA -invert 1]
   
puts "but1 orientation = [$but1 cget -orientation]"
puts "but3 orientation = [$but3 cget -orientation]"

puts "but1 invert = [$but1 cget -invert]"
puts "but2 invert = [$but2 cget -invert]"

$hbox add $but1 -fill 1 -expand 1
$hbox add $but2 -fill 1 -expand 1
$hbox add $but3 -fill 1 -expand 1
$hbox add $but4 -fill 1 -expand 1
   
gnocl::window -child $hbox -title "Button -invert and -orientation"




Saturday, March 07, 2020

March Update

Again, some time has passed since the last post but still work is going on. It would appear that most of the runtime issues arising from compiling against the Gtk 2.24 libraries are now resolved. Here's the relevant notices from the project NEWS file.

As always, latest distributables available from Sourceforge.

2020-02:
   gnocl::labelText
        o label now positions to topLeft by default
        o set command now works
        o cget -value also works (same as set command)
   gnocl::labelEntry
        o cget -label now works properly
   gnocl::info
        o added option "tmp", returns location of system temporary directory
   gnocl::scale
        o added -heightRequest and -widthRequest
   gnocl::comboEntry
        o new command: wordlist. Returns a list of items displayed in the pull-down menu.
   gnocl::text
        o problems with keywords "wordStart" and "wordEnd" now fixed
        o new commands: backChars and forwardChars
        o new tag sub-command: exists -returns 1 if a named tag exists in tagtable otherwise 0.

2020-01:
   gnocl::dialog
        o now displays correct window icon
   gnocl::richTextToolBar
        o new option -sensitive

2019-12:
   gnoc::splashscreen
        o new option -verbose
   gnocl::text
        o undo/redo functionality working properly again.
   gnocl::pixBuf
        o new object commands: geometry and textExtents.
        o draw command retired, use rectangle command for similar options.
        o the draw command relied upon the api function gdk_draw_pixbuf which was deprecated Gtk 2.21.
        o fixed width problems with brightness filter.
        o brightnessRange moved to list of pixbuf sub-commands.
        o problems with flood fill colour fixed.
        o new object command, option - option set , option get , option remove , and option keys.