OriginalBugID: 5397 Bug
Version: 8.3.1
SubmitDate: '2000-05-09'
LastModified:
Severity: MED
Status: UnAssn
Submitter: techsupp
OS: Linux-Red Hat
Machine: P II - 350, 384M ram, ATI expert 8M running at 1280x1024
Name:
Spiros J Boucouris
Extensions:
none
ReproducibleScript:
For custom canvas items to use the the object interface, alwaysRedraw must be or'ed
with TK_CONFIG_OBJS. I did not find that documented anywhere. Or'ing TK_CONFIG_OBJS
with flags is documented in the header. In short, the object interface requires multiple "configurations"
in the user's code.
ObservedBehavior:
Provide a reasonably complete (point form) guide for using the object interface with canvas items. Presently, even the header files do not have all the information. One has to dig into tkCanvas.c.
DesiredBehavior:
I would like to see a cleaner object interface for custom canvas items (similar to the dual
cmd / objcmd used in Tcl. Presently the code does all sorts of casts based on information
the user must provide at multiple places. In short I would like an interface no less robust
than the previous (ono-object) one.
Logged In: YES
user_id=585068
I ran into this same bug, so perhaps bringing this up will
lead to some solution that pleases everyone.
The documentation for the canvas is incorrect. By following
the directions in the CrtItemType.3 manual page the result
is a segfault. The ->alwaysRedraw member should actually be
used like so:
->alwaysRedraw = /* 0 or 1 */;
->alwaysRedraw |= TK_CONFIG_OBJS;
The Tk core widgets I looked at briefly use just
TK_CONFIG_OBJS when defining a Tk_ItemType.
Perhaps in the future we could add ->flags, and of course
fix the documentation.
fixed already by dkf (CrtItemType.3 1.14)
Left open for backport to Tk 8.5
I think it would be neater if we had a defined flag bit name for bit0, perhaps TK_ALWAYS_REDRAW or something like that. Leave this open for now; I don't think we've got a good enough solution yet...
How about renaming the "alwaysRedraw" field to "flags", and
adding the following lines somewhere in tk.h:
#define TK_ALWAYS_REDRAW 1
#ifdef TK_COMPAT_ALWAYS_REDRAW
# define alwaysRedraw flags
#endif
Then extensions can define TK_COMPAT_ALWAYS_REDRAW
when they want to remain source compatible with <Tk8.6.
It's a little risk (only if extensions use the
"alwaysRedraw" token for something else as well).
It's fully binary compatible, and the documentation
can be fixed 'the right way'....