Home > Archive > PerlTk > August 2006 > getting the screen position of widget placed with grid screen manager
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 |
getting the screen position of widget placed with grid screen manager
|
|
| jack london 2006-08-16, 8:01 am |
| Hello,
I want to put a widget1 exactly onto an WIDGET2 placed with "grid"
manager. WIDGET1 is bigger that WIDGET2 so I want to use "place"
manager to place it. To do that I need to know the screen position of
WIDGET1, but the following doesn't work
$WIDGET1->grid(-row => 12, -column => 1, -rowspan => 1, -columnspan =>
2, -sticky => 'nsew');
my $x = $WIDGET1->x;
my $y = $WIDGET1->x;
$WIDGET2->place(-x => $x, -y => $y);
the problem is that $widget->x (and ->y) always gives 0.
Is it possible to get the real screen position (absolute or relative to
parent) of a widget placed with GRID manager?
Thanks,
Davide
| |
| smallpond@juno.com 2006-08-16, 6:59 pm |
|
jack london wrote:
> Hello,
>
> I want to put a widget1 exactly onto an WIDGET2 placed with "grid"
> manager. WIDGET1 is bigger that WIDGET2 so I want to use "place"
> manager to place it. To do that I need to know the screen position of
> WIDGET1, but the following doesn't work
>
> $WIDGET1->grid(-row => 12, -column => 1, -rowspan => 1, -columnspan =>
> 2, -sticky => 'nsew');
>
> my $x = $WIDGET1->x;
> my $y = $WIDGET1->x;
>
> $WIDGET2->place(-x => $x, -y => $y);
>
> the problem is that $widget->x (and ->y) always gives 0.
> Is it possible to get the real screen position (absolute or relative to
> parent) of a widget placed with GRID manager?
>
> Thanks,
> Davide
I think you want gridBbox which gives you x and y relative to the
enclosing window, which is the same thing place expects for x & y.
-- S
| |
| Ala Qumsieh 2006-08-18, 6:58 pm |
| jack london wrote:
> Hello,
>
> I want to put a widget1 exactly onto an WIDGET2 placed with "grid"
> manager. WIDGET1 is bigger that WIDGET2 so I want to use "place"
> manager to place it. To do that I need to know the screen position of
> WIDGET1, but the following doesn't work
>
> $WIDGET1->grid(-row => 12, -column => 1, -rowspan => 1, -columnspan =>
> 2, -sticky => 'nsew');
Try:
$WIDGET1->update;
here.
> my $x = $WIDGET1->x;
> my $y = $WIDGET1->x;
>
> $WIDGET2->place(-x => $x, -y => $y);
>
> the problem is that $widget->x (and ->y) always gives 0.
--Ala
| |
| filippo 2006-08-23, 6:58 pm |
|
Ala Qumsieh ha scritto:
> Try:
>
> $WIDGET1->update;
thanks Ala, this solved my problem.
|
|
|
|
|