For Programmers: Free Programming Magazines  


Home > Archive > Tcl > October 2004 > Can a widget be notified when a font changes?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can a widget be notified when a font changes?
Georgios Petasis

2004-10-09, 4:23 pm

Hi all,

I am trying to use the SelectFont BWidget widget, and I am not sure I am
using it correctly.

I have defined 3-4 named fonts (through font create) which are used
in a canvas widget for text items. I also use the SelectFont widget as
a toolbar, to configure these fonts. However, as the app may have multiple
windows, many SelectFont widgets are visible. All of them can be used
to configure the same named fonts, but I haven't find a way to also update
the rest SelectFont widgets to get them all in sync.

I suppose that for this to happen, we need traces on font changes?
I suppose that widgets at the C lever get somehow notified (as configuring
a font seems to redraw anythin the font is used), but is a way to get this
information
at the tcl level?

(I suppose I can do this in the widget's callback, where I reconfigure the
font
myself, but it would be good if this could be automated somehow...)

George


Helmut Giese

2004-10-09, 4:23 pm

On Sat, 9 Oct 2004 17:47:24 +0300, "Georgios Petasis"
<petasis@iit.demokritos.gr> wrote:

>Hi all,
>
>I am trying to use the SelectFont BWidget widget, and I am not sure I am
>using it correctly.
>
>I have defined 3-4 named fonts (through font create) which are used
>in a canvas widget for text items. I also use the SelectFont widget as
>a toolbar, to configure these fonts. However, as the app may have multiple
>windows, many SelectFont widgets are visible. All of them can be used
>to configure the same named fonts, but I haven't find a way to also update
>the rest SelectFont widgets to get them all in sync.

How about having just one SelectFont widget, and each visible toolbar
button invokes this sole instance?
Helmut Giese
Jeff Hobbs

2004-10-24, 3:57 pm

Georgios Petasis wrote:
> I suppose that for this to happen, we need traces on font changes?


Yes, this is a hole in the font level code. I would recommend
adding a -command callback to 'font create' for 8.5.

--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com