|
From: Paul W. <wal...@gm...> - 2006-04-03 19:28:34
|
The theme I'm working on is a replica of Java Swing. The highlight element
would be perfect, except I need it be around the button label, as opposed t=
o
around the entire button. As far as I can tell, this isn't possible with
the highlight element.
I was able to create the focus element using a 3x3 image with the middle
pixel transparent. The transparent part is stretched and so there is a one
pixel border around the labels on buttons, checkbuttons, and radiobuttons.
This works great except for one problem. The problem is it is extremely
slow to draw the widgets. If I switch from a different theme to my theme,
it takes 1-2 seconds to update all the widgets on the Tile demo. The same
thing happens if I just switch between windows. This is on Windows XP with
Tile 0.7.3. Any idea why it is so slow?
Here is the exact code I am using:
style element create focus image $I(focusring-u) \
-border {1 1 1 1} \
-padding {1 1} \
-sticky nwse \
-map [list focus $I(focusring-f)]
And here are the images:
http://img448.imageshack.us/img448/5894/focusringu7tw.gif
http://img448.imageshack.us/img448/4585/focusringf2uy.gif
You should be able to just drop the code and images into the blue theme to
see the problem.
>> Is there a way to change the focus ring to something different? For
>> instance, a solid blue ring? I'm working on a theme that doesn't look
right
>> with the default dashed focus ring, so for now I've taken the ring out o=
f
>> all the buttons, but I'd like to implement a more appropiate focus
indicator
>> for this theme. Is there any way to do it?
>
>Probably. What theme is yours based on?
>
>The "highlight" element from the "classic" theme might do what
>you want -- it just calls Tk_DrawFocusHighlight() with values
>derived from the -highlightthickness and -highlightcolor
>element options.
>
>You can import it into your theme with:
>
> style element create highlight from classic
>
>and use it like:
>
> style layout TButton {
> TButton.highlight -children { ... }
> }
> style default TButton -highlightthickness 1
> style map TButton -highlightcolor \
> [list focus $accentColor {} $frameColor]
>
>You could also change border colors (this is how
>the 'clam' theme draws the focus ring for entry widgets,
>for instance). How to do this depends on which border
>element you're using.
>
>
>--JE
|