Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Announce: flexmenu 1.21 (beta)

38 views
Skip to first unread message

Brad Lanam

unread,
Dec 4, 2018, 12:54:56 PM12/4/18
to
( As the wiki doesn't work (for me), I am posting this here.
Though the wiki flexmenu page is updated, it does not display the changes ).

I think this is finally ready for some beta testing.

An alternative menu system.

Source: https://gentoo.com/tcl/flexmenu.tcl

Sourceforge: https://sourceforge.net/projects/tcl-flexmenu/

The best documentation is internal to the tcl-flexmenu.tcl file.

Mac users: if you like the mac global menu, don't use this.


Disadvantages:

Does not work with .toplevel configure -menu .mymenu. Tk uses the internal menu API to attach menus. flexmenu cannot work with the -menu option.

Must use pack or grid (or place) to attach the menu. Converting an existing program to use flexmenu could be quite painful.

The main menu must be created with either -type menubar or -type menuleft.

It has not been tested much.



Features:

* Checkbuttons and Radiobuttons are ttk widgets.
* Supports left side menus (-type menuleft).
* Scrolling menus (-maxheight).
* Configure -columnbreak <value> at the menu level to automatically break every <value> items.
* -keepopen option will leave the menu open after invoking an item.
* -acceleratorfont, -acceleratorforeground and -acceleratoractiveforeground options.
* -activerelief option.
* -hidearrows option.
* -hideaccelerators option.
* -bindaccelerators option.
* -acceleratorprefix option to set the default accelerator prefix.
* -padx, -pady options to change the padding for menu items.
* -bindaccelerators option.
* -stickycascade option.
* -mode option (frame or toplevel, mac only supports frame)
* Is a little more dynamic than the standard menu. Many things can be reconfigured and the changes will be picked up.


Item Features:

* Any widget can be put into the menu (.mymenu add widget -widget .mymenu.mycombobox).
* Margin images (-marginimage). It is quite common nowadays to use small icons on the left margin of the menu as an aid for the user.
* Accelerator labels are automatically generated based on either an & prefix in the label, the -underline option, or the -accelerator option.
* Accelerator bindings are automatically generated.
* -activerelief option.
* -gap option.
* Cascades: -yalign, -xalign, -precommand


A simple example:

package require Tk
source flexmenu.tcl

set clock {}

proc doclock { } {
global clock
set clock [clock format [clock seconds] \
-format "%Y-%M-%d %r" -locale system]
after 500 ::doclock
}

flexmenu .mtop -type menubar
.mtop add command -label E&xit -command exit
.mtop add separator
.mtop add command -label Exit -underline 0 -command exit
.mtop add command -label Help -underline 0 -command exit -gap true
doclock
ttk::style map Clock.TLabel -foreground [list disabled darkblue]
ttk::label .clock -textvariable clock -style Clock.TLabel
.mtop add widget -widget .clock -hidemargin true -state disabled
pack .mtop -side top -fill x -expand 1 -anchor nw

ttk::frame .f -width 400 -height 300
pack .f
lower .f
. configure -background [ttk::style lookup . -background]
0 new messages