-takefocus and new widgets written in C

-takefocus and new widgets written in C

Post by Geoff Batt » Fri, 05 Dec 2003 02:34:38


Hi everyone,

I'm using a new widget written in C (but not by me!), as part of my
application. The new widget does not have a -takefocus option.

When tabbing between widgets, I get an error when tabbing from the widget
that immediately precedes the new widget, or shift-tabbing from the one
that follows it:

Stack Trace for Error:
extra characters after close-quote
while executing
"unknown option "-takefocus"
("uplevel" body line 1)
invoked from within
"uplevel #0 $value [list $w"
(procedure "tkFocusOK" line 9)
invoked from within
"tkFocusOK $cur"
(procedure "tk_focusNext" line 36)
invoked from within
"tk_focusNext .image.tbf.tb2.prediction.l"
invoked from within
"tkTabToWindow [tk_focusNext .image.tbf.tb2.prediction.l]"
(command bound to event)

I'm assuming that this error occurs because the new widget doesn't have a
-takefocus option. Am I right?

I'm just starting to learn about writing your own widgets in C, but would
like to avoid modifying the new widget to include a -takefocus option is
possible. Can anyone think of a work-around?

Bear in mind that I don't need keyboard focus to traverse to the new
widget, I just want focus to skip it and go to the next widget when
tabbing or shift-tabbing.

Many thanks in advance for any help,
Geoff.
 
 
 

-takefocus and new widgets written in C

Post by Geoff Batt » Fri, 05 Dec 2003 22:58:52

P.S.

A simple work-around would be to override the default tab bindings to
the widgets either side of the new widget. I am wondering if there is
something different I could do that would be more general, and not change
when widgets are moved etc.

Also, this raises the question of what other options must be specified for
bespoke C widgets in order to be fully compatible with existing tcl/tk
functionality.

Cheers,
Geoff.