Posts

Showing posts from June, 2012

gnocl::text -- getSelectionBounds

Image
Just added new command to the text widget functionality to retrieve the bounds of the text buffer selection. If there is no selection, then an empty string is returned, otherwise there is a list of four integers, in the form startRow startCol endRow endCol.

#---------------
# test-selectionBounds.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"
package require Gnocl

set txt [gnocl::text -wrapMode word]
$txt configure -onButtonRelease {
    puts [%w getSelectionBounds]
    }

$txt lorem

gnocl::window -child $txt -setSize 0.25


gnocl::setStyle -new command

Image
Gtk regards many widget properties as part of a system theme and are called 'style properties' and are not generally accessible via the Gtk+ api. The defaults for the widget can be over-ridden during run time and the loading of a resource file is an example of this. An alternative route, one in which only single changes are intended, can be taken using the new gnocl::setStyle command. This takes three arguments, the specific widget name, the style property name and the value to be assigned.  By default the widget names are NULL strings and, at present, can only be set following widget creation. One useful trick is to name the widget with its own gnocl id. The following script and screenshot show the command at work.


#---------------
# test-style.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"

package require Gnocl

set ent(1) [gnocl::entry -name b1 -value "Gnocl"]
set ent(2) [gnocl::entry -name b2 -value "Gnocl"]
set ent(3) [gnocl::entry -na…

gnocl::progress -visible * NOW WORKING

Image
In the Gtk2+ Libs the "visible" property in GtkProgress widget is not implemented. In order todo this the commands gtk_widget_show and  gtk_widget_hide have to be called. Hitherto it was possible to set the gnocl::progresssBar -visible option but it would have no effect. This has now been remedied. It will respond as expected.