Wednesday, March 17, 2010

NEW COMMANDS for gnocl::text - getIndex and lorem

In response to a support enquiry I received a few days ago, I’ve just added a new widget command for gnocl::text that returns the line and character position under  specified window coordinates. Here’s how it can be used: 

set txt [gnocl::text -wrapMode word -baseFont {ILShakeFest 12} ]
$txt lorem


gnocl::window -child $txt -widthRequest 320 -heightRequest 200
$txt configure -onButtonPress {
   puts "x = %x y = %y ; index = [%w getIndex %x %y]"
}

Also, because I’m getting annoyed always having to cut-n-paste text clips into a text widget for preview purposes, I’ve decided to add a further command: lorem. This will insert a paragraph of the well-recognised typesetter dummy text. Add to it an antique typeface and it looks totally wacky and completely illegible! Here’s a screenshot. (NB: I Wouldn't recommend ILShakeFest as a system font!]


No comments: