RE: determine if optional scrollbar visible
"Jack D." <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of listmail > Sent: December 4, 2005 3:38 PM > To: [email protected] > Subject: determine if optional scrollbar visible > > Is there anyway I can determine if an optional scrollbar > (defined as part of a scrolled hlist widget) is currently > visibile or not? Use the "ismapped" method documented in Tk::Widget. Here is an example using a Scrolled('Text') widget. ############################### use Tk; use strict; my $check=''; my $mw=tkinit; my $t=$mw->Scrolled('Text', -wrap=>'none', -scrollbars=>'osoe')->pack(-fill=>'both', -expand=>1); $mw->Button( -text=>'Check for scrollbar', -command=>\&checkForScroll)->pack; $mw->Label(-textvariable=>\$check)->pack(-fill=>'x'); MainLoop; sub checkForScroll { my $yscroll = $t->Subwidget('yscrollbar'); my $xscroll = $t->Subwidget('xscrollbar'); if ($yscroll->ismapped and $xscroll->ismapped) { $check="Both scrollbars are mapped"; } elsif ($yscroll->ismapped) { $check="Y Scrollbar is mapped"; } elsif ($xscroll->ismapped) { $check="X Scrollbar is mapped"; } else { $check="No Scrollbars are mapped"; } $mw->after(1500,sub{$check=''}); } __END__ ############################### -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubscribe from this mailing list, send the message body of "unsubscribe ptk" to [email protected]