For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > April 2004 > Using Textundo - Menu question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using Textundo - Menu question
peter@notvalid.se

2004-04-28, 5:39 pm


Hi

I would like to modify the default menu in textundo.

I have figured out how to remove the default menu and make my own,
but since I'm only interested in removing a few menuitems
from the 'File' menu it seems like a lot of work to build it
all from scratch.

The things I would like to remove are the:
Open, SaveAs, Include & Clear.

So if you have some tips I would apreciate it.


Another related thing I'm wondering about is:

Is ther some way I can change all labels to
another language? Again I think I can do that by
rebuilding the whole menu but I'd rater not.

/Peter
Jack D

2004-04-29, 12:04 am

<peter@notvalid.se> wrote in message news:uk6zzj14h.fsf@notvalid.se...
>
> Hi
>
> I would like to modify the default menu in textundo.
>
> I have figured out how to remove the default menu and make my own,
> but since I'm only interested in removing a few menuitems
> from the 'File' menu it seems like a lot of work to build it
> all from scratch.
>
> The things I would like to remove are the:
> Open, SaveAs, Include & Clear.
>
> So if you have some tips I would apreciate it.
>


Google has many anwers - including this one:

http://groups.google.com/groups?sel...telusplanet.net

>
> Another related thing I'm wondering about is:
>
> Is ther some way I can change all labels to
> another language? Again I think I can do that by
> rebuilding the whole menu but I'd rater not.


I have an application which does exactly that. It rebuilds the whole menu.
It only takes about half a second. Also - I found it was much easier to do
by creating the menus the "old-fashioned" way as per 'widget'.

I read english and french phrases into a hash from a config file and just
change the key to point to the new phrases.

Jack






peter@notvalid.se

2004-04-29, 6:47 am

"Jack D" <goodcall__1@hotmail.com> writes:

> <peter@notvalid.se> wrote in message news:uk6zzj14h.fsf@notvalid.se...
>
> Google has many anwers - including this one:
>
> http://groups.google.com/groups?sel...telusplanet.net


Ahh. I was not yet aware of the entrycget method. It makes
things much easyer.


Snip of relevant info in that post for other people googeling in the future:

my $textmenu=$text->menu;
#get the menu associated with 'File'
my $filemenu=$textmenu->entrycget('File',-menu);
#Delete the 'Exit' command
$filemenu->delete(0);
#Replace it with your own
$filemenu->insert(0,'command',-label => 'Press Me',
-command=> sub{print "I was pressed\n"});



>
> I have an application which does exactly that. It rebuilds the whole menu.
> It only takes about half a second. Also - I found it was much easier to do
> by creating the menus the "old-fashioned" way as per 'widget'.
>
> I read english and french phrases into a hash from a config file and just
> change the key to point to the new phrases.


That's what I have been doing in my main application.
I was just hoping for a shortcut.....



Thanks for your help.

/Peter
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com