Subject: Help with C API and widgets - DN [1]


lduperval@sprint.ca - 10 Jul 2000 - comp.lang.tcl

 HI,

 I'm in the process of changing the way Tk treats the -underline option in
 button-like widgets. My work will allow one to use a string like "abc&def" and
 an option like "-underline &" which will put the underline at the character
 after the '&'. That's the goal, but I'm not there yet. I'm hoping to finisih
 it by the time a2 is ready.

 My problem is that once I've determined what character is after the '&', I
 have to modify the textual part so that the '&' is removed, or at the very
 least, isn't displayed. My current option is to take whatever text appears
 after the '&' and move it one character to the left. This will, in effect,
 overwrite the '&'. The widget->underline value will contain an integer which
 will point to the correct character where the underline will appear, so that
 none of the code to display the button will need to be changed.

 My problem is that I'm not sure what funcions I'm supposed to use to overwrite
 the original strings. If I was only dealing with ASCII, I'd use strcpy() and
 strchr() to do this but there doesn't seem to be an equivalent to strcpy() in
 all of the UTF/Unicode commands. What's the proper way to do this?

 ALso, I don't have much experience dealing eith the widgets. When a command
 like

 .b configure -option foo

 is issued, will all the options be reprocessed or only the ones that have
 changed? Do I need to keep two string representations: one with the '&' and
 one without?

 Thanks,

 L

Last modified
2000-07-20

(195.108.246.52)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated