Bwidget Source Code
Check-in [96249ade71]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:mainframe.tcl: Allow to skip a main menu level by empty menu label. Purpose: support commands/checkboxes at first level.
Timelines: family | ancestors | bwidget
Files: files | file ages | folders
SHA3-256: 96249ade7110496e3de146c7532d0c9877ac978f1f648b62900f14bd1777a43f
User & Date: oehhar 2019-05-07 11:34:08
Context
2019-05-07
11:34
mainframe.tcl: Allow to skip a main menu level by empty menu label. Purpose: support commands/checkboxes at first level. Leaf check-in: 96249ade71 user: oehhar tags: bwidget
2019-05-06
16:59
mainframe.tcl: Add optional parameter "Top" to internal function "MainFrame::_create_menubar" to allow to use a menu button for the main menu (Hack). check-in: 0c75c51ff3 user: oehhar tags: bwidget
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1
2
3
4
5
6
7
8


9
10
11
12
13
14
15
2019-05-06 Harald Oehlmann <[email protected]>
	mainframe.tcl: Add optional parameter "Top" to internal
	function "MainFrame::_create_menubar" to allow to use
	a menu button for the main menu (Hack).
	The mainframe may be initialized with "- menu {}".
	Then, the menubutton may be created and the menu may
	by added by:
	MainFrame::_create_menubar .mf $mitems $menubutton



2018-12-11 Harald Oehlmann <[email protected]>
	scrollframe.tcl: use Tk8.7 TIP 518 virtual event
	<<NoManagedChild>> to resize client frame to 1x1 when
	last child is unmapped.

2018-12-06 Harald Oehlmann <[email protected]>






|
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2019-05-06 Harald Oehlmann <[email protected]>
	mainframe.tcl: Add optional parameter "Top" to internal
	function "MainFrame::_create_menubar" to allow to use
	a menu button for the main menu (Hack).
	The mainframe may be initialized with "- menu {}".
	Then, the menubutton may be created and the menu may
	by added by:
	MainFrame::_create_menubar .mf $mitems $menubutton.
	Allow to skip a main menu level by empty menu label.
	Purpose: support commands/checkboxes at first level.

2018-12-11 Harald Oehlmann <oehh[email protected]>
	scrollframe.tcl: use Tk8.7 TIP 518 virtual event
	<<NoManagedChild>> to resize client frame to 1x1 when
	last child is unmapped.

2018-12-06 Harald Oehlmann <[email protected]>

Changes to mainframe.tcl.

555
556
557
558
559
560
561








562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586

587
588
589
590
591
592
593
	set menuopts [list]
    }
    set menubar [eval [list menu $top.menubar -tearoff 0] $menuopts $mbfnt]
    $top configure -menu $menubar

    set count 0
    foreach {name tags menuid tearoff entries} $descmenu {








        set opt  [_parse_name $name]
        if {[string length $menuid]
	    && ![info exists _widget($path,menuid,$menuid)] } {
            # menu has identifier
	    # we use it for its pathname, to enable special menu entries
	    # (help, system, ...)
	    set menu $menubar.$menuid
        } else {
	    set menu $menubar.menu$count
	}
        eval [list $menubar add cascade] $opt [list -menu $menu]
        eval [list menu $menu -tearoff $tearoff] $menuopts $mefnt
        foreach tag $tags {
            lappend _widget($path,tags,$tag) $menubar $count
	    # [email protected]:  Add a tagstate tracker
	    if { ![info exists _widget($path,tagstate,$tag)] } {
		set _widget($path,tagstate,$tag) 1
	    }
        }
	# [email protected]:  Add mapping from menu items to tags
	set _widget($path,menutags,[list $menubar $count]) $tags

        if { [string length $menuid] } {
            # menu has identifier
            set _widget($path,menuid,$menuid) $menu

        }
        _create_entries $path $menu $menuopts $entries
        incr count
    }
}








>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
>







555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
	set menuopts [list]
    }
    set menubar [eval [list menu $top.menubar -tearoff 0] $menuopts $mbfnt]
    $top configure -menu $menubar

    set count 0
    foreach {name tags menuid tearoff entries} $descmenu {
        # Check if only one menu with an empty name is given
        # In this case, remove the top level menu item
        # This allows to also have checkboxes and commands at the top level.
        if {![string length $name] && 5 == [llength $descmenu]} {
            # A single namesless menu - skip the first level to allow other
            # than cascade as first level.
            set menu $menubar
        } else {
            set opt  [_parse_name $name]
            if {[string length $menuid]
                    && ![info exists _widget($path,menuid,$menuid)] } {
                # menu has identifier
                # we use it for its pathname, to enable special menu entries
                # (help, system, ...)
                set menu $menubar.$menuid
            } else {
                set menu $menubar.menu$count
            }
            eval [list $menubar add cascade] $opt [list -menu $menu]
            eval [list menu $menu -tearoff $tearoff] $menuopts $mefnt
            foreach tag $tags {
                lappend _widget($path,tags,$tag) $menubar $count
                # [email protected]:  Add a tagstate tracker
                if { ![info exists _widget($path,tagstate,$tag)] } {
                    set _widget($path,tagstate,$tag) 1
                }
            }
            # [email protected]:  Add mapping from menu items to tags
            set _widget($path,menutags,[list $menubar $count]) $tags

            if { [string length $menuid] } {
                # menu has identifier
                set _widget($path,menuid,$menuid) $menu
            }
        }
        _create_entries $path $menu $menuopts $entries
        incr count
    }
}