Search code examples
perlwxwidgetspointobject-reference

WxPerl, getting coordinates from wxPoint object


I want solve this problem.

  1. get position from specific frame (wxFrame) (function GetPosition() return WxPoint)
  2. Serialize position (x, y) to file
  3. set position from file to another window

Everythink is ok, except getting coordinates x and y from WxPoint object. I don't know, how can I acces properties "x", "y" of this object. e.g wxPython allows this by "somepoint.x", but WxPerl? somepoint->{"x"} doesn't work, because object is SCALAR reference..

Thank you


Solution

  • The following should do what you're looking for:

    my $point = $frame->GetPosition;
    
    my $x = $point->x;
    my $y = $point->y;