|
|
| Ian Bell 2005-04-26, 8:58 pm |
| I am using a horizontal menubar (Tk8.x) for a gui based on the method
described by Brent Welch. I use the man pages a lot for checking syntax and
options but the menubar man page in fact covers the tk_menuBar procedure
which is deprecated from TK4.0 onwards not the widget.
Is this an error in the man pages or have I missed something?
Ian
| |
| Bryan Oakley 2005-04-26, 8:58 pm |
| Ian Bell wrote:
> I am using a horizontal menubar (Tk8.x) for a gui based on the method
> described by Brent Welch. I use the man pages a lot for checking syntax and
> options but the menubar man page in fact covers the tk_menuBar procedure
> which is deprecated from TK4.0 onwards not the widget.
>
> Is this an error in the man pages or have I missed something?
>
> Ian
Is _what_ an error? That tk_menuBar is deprecated? I doubt it's an
error. The recommended way to create a menubar these days is to create a
menu, then associate that with a toplevel. It's very simple:
menu .menubar
menu .menubar.fileMenu
menu .menubar.editMenu
....
..menubar add cascade -label File -menu .menubar.fileMenu ...
..menubar add cascade -label Edit -menu .menubar.editMenu ...
....
.. configure -menu .menubar
| |
| Ian Bell 2005-04-26, 8:58 pm |
| Bryan Oakley wrote:
>
> Is _what_ an error? That tk_menuBar is deprecated?
No, that when I select the menubar man page I do not get a page describing
the menubar *widget* but instead one describing the tk_menuBar *proc*.
> I doubt it's an
> error. The recommended way to create a menubar these days is to create a
> menu, then associate that with a toplevel. It's very simple:
>
> menu .menubar
> menu .menubar.fileMenu
> menu .menubar.editMenu
> ...
> .menubar add cascade -label File -menu .menubar.fileMenu ...
> .menubar add cascade -label Edit -menu .menubar.editMenu ...
> ...
> . configure -menu .menubar
Yup, that's what I am doing. I realise now that I was confusing the naming
of the *menu* widget as .menubar and kept thinking of the *menubar* widget
rather than a menu widget *named* .menubar.
I think I will name the top menu something not similar to a widget name from
now on. So my code will look something like.
menu .topmenu
.. config -menu .topmenu
foreach m {File Edit Help} { # or whatever
set $m [menu .topmenu.m$m]
.topmenu add cascade -label $m -menu .topmenu.m$m
}
etc
Ian
| |
| Bruce Hartweg 2005-04-27, 3:59 am |
|
Ian Bell wrote:
> Bryan Oakley wrote:
>
>
>
>
> No, that when I select the menubar man page I do not get a page describing
> the menubar *widget* but instead one describing the tk_menuBar *proc*.
>
>
>
>
> Yup, that's what I am doing. I realise now that I was confusing the naming
> of the *menu* widget as .menubar and kept thinking of the *menubar* widget
> rather than a menu widget *named* .menubar.
>
> I think I will name the top menu something not similar to a widget name from
> now on. So my code will look something like.
>
> menu .topmenu
> . config -menu .topmenu
> foreach m {File Edit Help} { # or whatever
> set $m [menu .topmenu.m$m]
> .topmenu add cascade -label $m -menu .topmenu.m$m
> }
> etc
>
> Ian
I think you have it now, but just to clarify -
there is NOT a menubar *widget* in Tk.
Bruce
| |
| Ian Bell 2005-04-27, 4:00 pm |
| Bruce Hartweg wrote:
>
> I think you have it now, but just to clarify -
> there is NOT a menubar *widget* in Tk.
>
> Bruce
I just twigged that. What me is that there is a man entry for
tk_menuBar AND plain menubar both of which end up at the *same* man page.
I am now going off to confuse myself further with message and messageBox
(tk_messageBox) ;-)
Thanks for your help.
Ian
Ian
|
|
|
|