ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-win32-users
perl-win32-users
RE: Strange Perl/Tk action
by Brian Raven other posts by this author
Oct 26 2009 3:52AM messages near this date
view in the new Beta List Site
RE: Strange Perl/Tk action | RE: Strange Perl/Tk action
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:goodcall1@[...].com]
>  Sent: Saturday, October 24, 2009 10:51 PM
>  To: 'Geoff Horsnell'; perl-win32-users@[...].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-bounces@[...].com
>  [mailto:perl-win32-users-bounces@[...].com] On Behalf
>  Of 
>  Geoff Horsnell
>  Sent: October-24-09 10:05 AM
>  To: perl-win32-users@[...].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 inten
ded 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 stric
tly forbidden.

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Geoff Horsnell
Jack
Geoff Horsnell
Brian Raven
Jack
Geoff Horsnell

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved