How to add menu entry from TextUndo to Toplevel widget 
Author Message
 How to add menu entry from TextUndo to Toplevel widget

Hello,

How can I add EditMenuItems (only Edit entry) from TextUndo widget to
my Toplevel widget menu (between File and Help entries)? Below is the
piece of code where I want to add Edit entry from TextUndo widget.

snip-- snip--

# Add menubar
$mw->configure(-menu => my $menubar = $mw->Menu);

# Add a new entry to the menu
my $file = $menubar->cascade(qw/-label File -underline 0 -menuitems/
=>
    [
        [command => '~New',         -command => \&newDialog],
        [command => '~Open...',     -command => \&openDialog],
        '',
        [command => '~Save',        -command => [\&saveDialog, 's']],
        [command => 'Save ~As...',  -command => [\&saveDialog, 'a']],
        '',
        [command => 'E~xit',        -command => sub{exit if
confirmCh();}],
    ]);

# Add a new entry to the menu
my $help = $menubar->cascade(qw/-label Help -underline 0 -menuitems/
=>
    [
        [command => '~Commands...', -accelerator => 'F5',
                                    -command => \&commandHelp],
        [command => '~About...',    -command => \&aboutDialog],
    ]);

# Create a widget with attached scrollbar(s)
my $tw = $mw->Scrolled(qw/
                       TextUndo
                       -relief sunken
                       -borderwidth 2
                       -setgrid 2
                       -wrap word
                       -width 80
                       -height 25
                       -scrollbars ose
                       /);

snip-- snip--

- Tomi



Sun, 27 Mar 2005 17:00:58 GMT  
 How to add menu entry from TextUndo to Toplevel widget

Quote:

> Hello,

> How can I add EditMenuItems (only Edit entry) from TextUndo widget to
> my Toplevel widget menu (between File and Help entries)? Below is the
> piece of code where I want to add Edit entry from TextUndo widget.

ptked is using the same menu for the right-mouse popup and the
toplevel menu. Look at the source code of ptked. If you want to use
only some cascades from the text menu, then try to get the menu
objects (with the help of $menu->entrycget(..., -menu)) and put the
cascade under the toplevel menu (not tested).

Regards,
        Slaven

--

sf-upload: make batch releases on SourceForge
        http://sf-upload.sf.net



Sun, 27 Mar 2005 19:31:18 GMT  
 How to add menu entry from TextUndo to Toplevel widget

Quote:

> ptked is using the same menu for the right-mouse popup and the
> toplevel menu. Look at the source code of ptked. If you want to use
> only some cascades from the text menu, then try to get the menu
> objects (with the help of $menu->entrycget(..., -menu)) and put the
> cascade under the toplevel menu (not tested).

> Regards,
>    Slaven

Thanks Slaven,
I managed to do it in next way:

$menubar->insert( 2, $tw->menu->type(1),
                  -label => $tw->menu->entrycget(1, -label),
                  -menu => $tw->menu->entrycget(1, -menu) );

- Tomi



Mon, 28 Mar 2005 15:27:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. deleting a menu entry in a Text widget

2. Popup menus in TextUndo

3. Bug in Tk::TextUndo widget.

4. Bug in Tk::TextUndo widget.

5. Tk::CodeText - syntax highlighting TextUndo widget.

6. TopLevel window without control menu

7. Initial Placement Of Toplevel Mega-Widgets

8. imbedding an xterm in Toplevel widget.

9. Change Icon for TopLevel widget?

10. placing toplevel widgets

11. toplevel widgets

12. Printing/Capturing a toplevel widget

 

 
Powered by phpBB® Forum Software