Wednesday, November 03, 2010

gnocl::drawingArea -more progress

I'm really pleased with the progress that I've made with this module today. The test script below gives some indication of how its shaping up. I''ve just added the ability to pass a list the option add command. Think that I've done enough for today.

# 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

# add options...
$da option add -onPointerMotion
$da option add -onEnter
$da option add -onLeave
$da option add [list -onButtonPress -onButtonRelease]
$da option add [list -onKeyPress -onKeyRelease -onExpose]

# configure them
$da configure -onPointerMotion {puts "%x %y"}
$da configure -onEnter {puts "Enter -Hello!"}
$da configure -onLeave {puts "Leave -Bye!"}
$da configure -onButtonPress {puts "You Clicked!"}
$da configure -onButtonRelease {puts "You Left-Go!"}
$da configure -onKeyPress {puts "Press"}
$da configure -onKeyRelease {puts "Release"}
$da configure -onExpose {puts "Exposed!"}


No comments: