Geoff Horsnell <> wrote:
> Unfortunately, it would be rather a lot of code. I will try to
> describe the action with example segments.
Which is why it is generally advisable to try to create a small example
script that illustrates the problem.
>
> ...
>
> sub create_all_menus {
> $mode = "A";
> $menub = $tl->Menu(-type => "menubar");
> $tl->configure (-menu => $menub);
> $widget1 = menub->cascade(-label => "Edit, -underline => 0,
> -tearoff => 0); $widget->pack(-side => "top", -anchor => "nw");
> &create_menu1 ($widget1);
> ...
> }
>
> sub create_menu1 {
> my $widget = shift;
>
> $state = "disabled";
> if ($mode eq "A") {
> $widget->command(-label => "B", -underline => 0, -command =>
> \&switchToB); $widget->command(-label => "A", -underline => 0,
> -command => \&switchToA, -state => $state); } else {
> $widget->command(-label => "B", -underline => 0, -command =>
> \&switchToB, -state => $state); $widget->command(-label => "A",
> -underline => 0, -command => \&switchToA); }
> }
> ...
> sub switchToA {
> $mode = "A";
> &create_all_menus (...); # repaint all menu buttons } Sub
> switchToB { $mode = "B";
> &create_all_menus (...); # repaint all menu buttons }
>
> After calling the "create_all_menus" from the main program, option
> "A" is greyed out and option "B" is active. When "B" is selected for
> the first time, option "B" is then greyed out and option "A" is
> active. At the same time, the height of the "canvas" window
> containing these menu buttons is reduced by about 0.2 cm. Subsequent
> selection of the "A" or "B" menu option (whichever is currently
> active) has no further effect on the size of the window.
>
> I hope this makes better sense.
>
> TIA
>
> Geoff
>
> -Original Message-
> From: Jack [mailto:goodca...@hotmail.com]
> Sent: Saturday, October 24, 2009 10:51 PM
> To: 'Geoff Horsnell'; perl-win32-users@listserv.activestate.com
> Subject: RE: Strange Perl/Tk action
>
>
> It's hard to follow your description. Can you upload some sample code
> that
> shows the problem?
>
> "Shrinkage is always bad" ;)
>
> Jack
>
>
> From: perl-win32-users-boun...@listserv.activestate.com
> [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf
> Of
> Geoff Horsnell
> Sent: October-24-09 10:05 AM
> To: perl-win32-users@listserv.activestate.com
> Subject: Strange Perl/Tk action
>
>
>
> I have created a GUI using the Tk "canvas" widget that contains a
> menu list
> with two mutually exclusive menu items - say "A" and "B". When "A" is
> selected, "B" should be disabled (greyed out) and vice versa.
> Therefore,
> when the currently active option is selected, the menu list needs to
> be
> repainted switching the active and disabled items. However, the first
> time
> that this happens, the height of the canvas window shrinks - by about
> the
> height of the menu tab. The height of the window remains unchanged
> for all
> subsequent menu actions. I have printed out the variable containing
> the
> nominated height of the window before and after making the selection
> and it
> does not change. I can compensate for this action by making the
> original
> window height slightly larger in the first place. However, I would
> rather
> that the shrinkage did not happen at all. Has anyone seen this happen
> for
> themselves and does anyone know how to prevent the window from
> shrinking in
> the first place?
>
> Any suggestions would be most welcome.
I may have missed something from your description and code, but it seems
to me that using radio buttons in your menu would be preferable, not to
mention simpler, than recreating it. The widget demo has examples if you
need them.
HTH
--
Brian Raven
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient or have received this e-mail in error, please advise
the sender immediately by reply e-mail and delete this message and any
attachments without retaining a copy.
Any unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs