Bwidget Source Code
Check-in [c8897b846d]
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:Added the new "menuonly" method, to make the main frame look nice in case all we want is a simple menubar. Also added support for function key bindings in the menu (F1 etc.).
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c8897b846dae20022616c8e5513cd2b1d878aadd
User & Date: sven 2000-01-24 16:35:38
Context
2000-01-24
22:24
Updated to reflect recent TEA changes check-in: 7c8eeb5052 user: wart tags: trunk
16:35
Added the new "menuonly" method, to make the main frame look nice in case all we want is a simple menubar. Also added support for function key bindings in the menu (F1 etc.). check-in: c8897b846d user: sven tags: trunk
2000-01-18
23:40
Updated to reflect recent TEA changes check-in: 56b768526d user: wart tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to mainframe.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
...
310
311
312
313
314
315
316











317
318
319
320
321
322
323
...
524
525
526
527
528
529
530



531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# ------------------------------------------------------------------------------
#  mainframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: mainframe.tcl,v 1.3 1999/09/19 22:40:00 ericm Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - MainFrame::create
#     - MainFrame::configure
#     - MainFrame::cget
#     - MainFrame::getframe
#     - MainFrame::addtoolbar
#     - MainFrame::gettoolbar
#     - MainFrame::addindicator
#     - MainFrame::getindicator
#     - MainFrame::getmenu

#     - MainFrame::showtoolbar
#     - MainFrame::showstatusbar
#     - MainFrame::_create_menubar
#     - MainFrame::_create_entries
#     - MainFrame::_parse_name
#     - MainFrame::_parse_accelerator
# ------------------------------------------------------------------------------
................................................................................
	    }
	    $menu entryconfigure $entry -state $state
	}
    }
    return
}













# ------------------------------------------------------------------------------
#  Command MainFrame::showtoolbar
# ------------------------------------------------------------------------------
proc MainFrame::showtoolbar { path index bool } {
    variable _widget

................................................................................
# ------------------------------------------------------------------------------
#  Command MainFrame::_parse_accelerator
# ------------------------------------------------------------------------------
proc MainFrame::_parse_accelerator { desc } {
    if { [llength $desc] == 2 } {
        set seq [lindex $desc 0]
        set key [lindex $desc 1]



        switch -- $seq {
            Ctrl {
                set accel "Ctrl+[string toupper $key]"
                set event "<Control-Key-[string tolower $key]>"
            }
            Alt {
                set accel "Atl+[string toupper $key]"
                set event "<Alt-Key-[string tolower $key]>"
            }
            CtrlAlt {
                set accel "Ctrl+Alt+[string toupper $key]"
                set event "<Control-Alt-Key-[string tolower $key]>"
            }
            default {
                return -code error "invalid accelerator code $seq"
            }
        }
        return [list $accel $event]
    }
    return {}
}




|











>







 







>
>
>
>
>
>
>
>
>
>
>







 







>
>
>



|



|



|











1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
...
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
# ------------------------------------------------------------------------------
#  mainframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: mainframe.tcl,v 1.4 2000/01/24 16:35:38 sven Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - MainFrame::create
#     - MainFrame::configure
#     - MainFrame::cget
#     - MainFrame::getframe
#     - MainFrame::addtoolbar
#     - MainFrame::gettoolbar
#     - MainFrame::addindicator
#     - MainFrame::getindicator
#     - MainFrame::getmenu
#     - MainFrame::menuonly
#     - MainFrame::showtoolbar
#     - MainFrame::showstatusbar
#     - MainFrame::_create_menubar
#     - MainFrame::_create_entries
#     - MainFrame::_parse_name
#     - MainFrame::_parse_accelerator
# ------------------------------------------------------------------------------
................................................................................
	    }
	    $menu entryconfigure $entry -state $state
	}
    }
    return
}


# ------------------------------------------------------------------------------
#  Command MainFrame::menuonly
# ------------------------------------------------------------------------------
proc MainFrame::menuonly { path } {
    variable _widget

    catch {pack forget $path.sep}
    catch {pack forget $path.botf.sep}
    catch {pack forget $path.frame}
}

# ------------------------------------------------------------------------------
#  Command MainFrame::showtoolbar
# ------------------------------------------------------------------------------
proc MainFrame::showtoolbar { path index bool } {
    variable _widget

................................................................................
# ------------------------------------------------------------------------------
#  Command MainFrame::_parse_accelerator
# ------------------------------------------------------------------------------
proc MainFrame::_parse_accelerator { desc } {
    if { [llength $desc] == 2 } {
        set seq [lindex $desc 0]
        set key [lindex $desc 1]
        if {![regexp {F[1]?[0-9]*} $key]} {
            set key [string tolower $key]
        }
        switch -- $seq {
            Ctrl {
                set accel "Ctrl+[string toupper $key]"
                set event "<Control-Key-$key>"
            }
            Alt {
                set accel "Atl+[string toupper $key]"
                set event "<Alt-Key-$key>"
            }
            CtrlAlt {
                set accel "Ctrl+Alt+[string toupper $key]"
                set event "<Control-Alt-Key-$key>"
            }
            default {
                return -code error "invalid accelerator code $seq"
            }
        }
        return [list $accel $event]
    }
    return {}
}