Re: Getting a scrolled widget's scrollbar from within an object



On Mon, 10 Apr 2006 16:07:26 +0200, Ch Lamprecht
<christoph.lamprecht.no.spam@xxxxxx> wrote:

zentara schrieb:
On Mon, 10 Apr 2006 00:46:28 +0200, Ch Lamprecht
<christoph.lamprecht.no.spam@xxxxxx> wrote:



sub _get_bars {
my $self = shift;
my $x = $self->parent->Subwidget('xscrollbar');
my $y = $self->parent->Subwidget('yscrollbar');
return ($x,$y);
}


Hi, that seems to work, but only after the $mw is visible.
Is it possible to run that from populate?

No, that's because Tk::Widget->Scrolled('widget') creates the 'widget'
before the Scrollbars...
Maybe you can set a hook using 'Map' or 'Visibility' events ?
Or (dirty trick) :

Hey, the "dirty trick" works with a delay value of 1. So that's
acceptable, I guess it just needs any delay to let the widget
setup first. :-)


sub Populate {
my ($self, $args) = @_;

$self->SUPER::Populate($args);
$self->SetBindtags;

print "populating\n";
$self->after(2000,sub{my ($x,$y)=$self->_get_bars();
print "$x $y\n";
});
} # end Populate


$self->after(1, sub{my ($x,$y)=$self->_get_bars();
print "$x $y\n";
});


HTH, Christoph

It certained did, thanks.


--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
.



Relevant Pages