From: MSEdit on 27 Nov 2009 11:23 I have several applications which use menubars and ttk. When the application changes its theme everything changes except the menus. What is the recomended way to change the menubar and all its entries, I cannot sem to find a way of listing the menus available. Martyn
From: Donal K. Fellows on 28 Nov 2009 03:24 On 27 Nov, 16:23, MSEdit <mse...(a)gmail.com> wrote: > I have several applications which use menubars and ttk. > > When the application changes its theme everything changes except the > menus. > > What is the recomended way to change the menubar and all its entries, > I cannot sem to find a way of listing the menus available. Menus aren't styled at all because Ttk doesn't supply them. (On Win and OSX, they're just straight native.) However, what you could do is to ask what the background of a [ttk::frame] is: ttk::style lookup TFrame -background And then configure the menu to use that as the background. That should give a reasonable approximation to what menus ought to be. (Remember to watch for the <<ThemeChanged>> virtual event so that you know when to look up the background and reapply it again.) Donal.
From: Arndt Roger Schneider on 28 Nov 2009 06:03 MSEdit schrieb: >[snip] >I cannot sem to find a way of listing the menus available. > >Martyn > > Well I assume you're running into the cloning functionallity in Tk. menu .menubar menu .xyz.menubar is cloned as ..#menubar ..xyz.#xyz#menubar The clone is what you see in your application. The best way to deal with menus is to generate them just before they are posted (aka postcommand), this also allows it to utilize commands as checkbuttons --as recommended in the AQUA Human Computer Interface Guidelines. Take a look at gstripes (X11 Only): http://gestaltitems.sourceforge.net/geitems/Gstripes_Menus.html ... the same mechanism could be used with ttk under X11, too. -roger
From: MSEdit on 30 Nov 2009 11:07 My problem is not to configure or find the colours but to be able to loop over the menubar elements. I already have code connected to the <<ThemeChanged>> virtual event (to change a couple of canvas backgrounds and a Bwidget notebook) what I need is a list of the menus for each window (preferably without changing all the menu creation code to record the menu id's). Is there no introspection command to give me a list of menus in the menu bar and for each menu a list of indexes to configure. Martyn
From: Pat Thoyts on 30 Nov 2009 14:01 MSEdit <msedit(a)gmail.com> writes: >My problem is not to configure or find the colours but to be able to >loop over the menubar elements. > >I already have code connected to the <<ThemeChanged>> virtual event >(to change a couple of canvas backgrounds and a Bwidget notebook) what >I need is a list of the menus for each window (preferably without >changing all the menu creation code to record the menu id's). > >Is there no introspection command to give me a list of menus in the >menu bar and for each menu a list of indexes to configure. set last [$menu index end] for {set index 0} {$index <= $last} {incr index} { if {[catch {$menu entrycget $index -label} label]} { set label "(separator)" } puts [list $index $label] } will list the labels for all menu entries in $menu. -- Pat Thoyts http://www.patthoyts.tk/ To reply, rot13 the return address or read the X-Address header. PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
|
Next
|
Last
Pages: 1 2 Prev: IPv6 address parsing/ validation Next: General low performance of wish in Windows |