Are the options blocked, when using Windows?
--
Zbigniew
Maybe I should add here, that both TkCmd/label.htm page, and
TkCmd/options.htm#M-highlightbackground contains _no_ information of the
type: "highlightbackground / highlightcolor are ignored on Windows".
The same for the menu problem, mentioned in my other post: no info in the
docs, that it won't work using Windows.
--
Zbigniew
highlightthickness works for me, though highlightcolor has no effect.
That's the price we pay for having native widgets I guess.
What are you trying to accomplish? Highlight colors don't make a whole
lot of sense for labels since they are only used when the widget has
keyboard focus and there's rarely a need to put focus on a label.
> highlightthickness works for me, though highlightcolor has no effect.
Yes, thickness can be set - but the "border" stays invisible.
highlightbackground and highlightcolor seem to be silently ignored.
> That's the price we pay for having native widgets I guess.
But it cannot be used not just while using winnative / xpnative themes - but
no theme under Windows has this attributes working. Are _completely all_
themes (including "default") built using "native widgets"?
If so - it's important information, that should be explicitly mentioned in
the docs, that these attributes are ignored on Windows.
> What are you trying to accomplish? Highlight colors don't make a whole
> lot of sense for labels since they are only used when the widget has
> keyboard focus and there's rarely a need to put focus on a label.
Inspired by "calendar" http://wiki.tcl.tk/13497 - I wanted to include such
calendar in my script. The Author used "Highlight colour"-border for marking
termins/schedules, and it's very good idea, because it's "natural" for any
calendar. It's how the days are marked on common printed calendars.
I wanted to make it exactly the same way for Windows/Linux, but as I can
see, I can't afford this on Windows, so the only option for me is changing
the background (or foreground) colour, as I wouldn't using canvas especially
for "painting" such borders.
--
Zbigniew
>Dnia 04.09.2009 ZB <zbWITHOUT_THIS@AND_THATjabster.pl> napisa�/a:
>
>> Unable to add "highlight"-border to label (Windows). Although the
>> "highlight"-related options are listed by "configure" - no colour/thickness
>> settings have any influence.
>>
>> Are the options blocked, when using Windows?
>
>Maybe I should add here, that both TkCmd/label.htm page, and
>TkCmd/options.htm#M-highlightbackground contains _no_ information of the
>type: "highlightbackground / highlightcolor are ignored on Windows".
They are not ignored - rather the underlying event never happens for
labels (on Windows).
As you probably know Tk on Windows uses native widgets. But here a
label can never be selected / get the focus, and therefore a label
will never highlight itself. (For good reason IMO, because a label
serves purely informative purposes - why should it change if you click
on it?)
If - for whatever reason - you want a label to get a "selected
appearance", you would have to use another widget like maybe a flat
button.
HTH
Helmut Giese
> They are not ignored - rather the underlying event never happens for
> labels (on Windows).
> As you probably know Tk on Windows uses native widgets. But here a
> label can never be selected / get the focus, and therefore a label
> will never highlight itself. (For good reason IMO, because a label
> serves purely informative purposes - why should it change if you click
> on it?)
But it _is_ selected, and changes itself - you can easily check it out
on your own trying Calendar Widget http://wiki.tcl.tk/13497 (maybe with
a really little changes).
Only that highlighting doesn't work, so it had to be replaced by foreground
colour change.
--
Zbigniew
> As you probably know Tk on Windows uses native widgets. But here a
> label can never be selected / get the focus,
Well, maybe if you meant in the sensse of that "more active" widgets - like
button or entry - that can be selected without making special binding.
Anyway: in such sense it can't be selected on Linux as well - but here
"highlighting" works.
--
Zbigniew
That's not exactly your _only_ option. Another choice is to put each
label in a frame and make that frame a couple pixels wider and taller
than the label. When you want to highlight it, change the color of the
frame. I've used this technique before and it's pretty simple.
As you said, you can also use the canvas as the container, and draw a
rectangle around whatever items you want highlighted. Yes, it's a tiny
bit more work but it's not that bad.
And finally, you can use a read-only text widget. The highlighting
works just fine there and it's real easy to make a text widget look
like a label (just configure the border and background appropriately).
Count your blessings! I've recently had to use wxPython and it is just
littered with platform inconsistencies. You've found a small edge
case (pun intended!) that effects very few real world problems.
> And finally, you can use a read-only text widget. The highlighting
> works just fine there and it's real easy to make a text widget look
> like a label (just configure the border and background appropriately).
Well, a set of frames containing "day-icons" is possible as well, then
switching icons...
> Count your blessings! I've recently had to use wxPython and it is just
> littered with platform inconsistencies. You've found a small edge
> case (pun intended!) that effects very few real world problems.
Not just one... ;) "another one" rather.
--
Zbigniew