|
From: Paul W. <wal...@gm...> - 2006-04-06 03:33:23
|
I've fixed the problem. Changing the focus ring images to a more reasonabl=
e
size like 10x10 did the trick. I suppose Tk was just slow at stretching th=
e
images. You could see it would take longer to display very wide buttons
than it would for smaller ones.
On 4/3/06, Paul Walton <wal...@gm...> wrote:
>
> 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 to 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 o=
ne
> 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 sam=
e
> thing happens if I just switch between windows. This is on Windows XP wi=
th
> 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 t=
o
> 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
> of
> >> 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
>
>
|