Tuesday, November 02, 2010

gnocl::drawingArea -more work done

GtkDrawingArea is basically the blank canvas from which other widgets are built up. The developer decided what signals and properties are to be applied to the object. The basic module for the gnocl::drawingArea has been around for some time and today I got it all running a little more smoothly and now that remains is to hard-code into the module the various choices and options that can be added during run-time. Here's the test script to show how simply the process is working out.

#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Gnocl

# create and display the drawingArea widget
set da [gnocl::drawingArea]
gnocl::window -widthRequest 320 -heightRequest 200 -child $da

$da option add -onPointerMotion
$da configure -onPointerMotion {puts "%x %y YIPPEEE!!!"}
$da option add -onEnter
$da configure -onEnter {puts "Enter -Hello!"}
$da option add -onLeave
$da configure -onLeave {puts "Leave -Bye!"}
$da option add -onButtonPress
$da configure -onButtonPress {puts "You Clicked!"}

gnocl::mainLoop

There's still some way to go, more error checking, the ability add a list of options etc...

Also did some more tidying up of the gnocl::ruler code.







No comments: