"move" method of Frame has no effect

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
henrylaw
In need of some credit
In need of some credit
Posts: 6
Joined: Wed Jan 24, 2018 8:43 pm

"move" method of Frame has no effect

Post by henrylaw »

Linux Mint, WxWidgets 3.0.2 (that's what dpkg tells me), with WxPerl (1.0) as the front end. (I hope this is the right forum to post in; I reviewed the descriptions carefully and still wasn't sure ...)

I have a small application which generates a single fixed-size window. It runs perfectly. I want to position the window at the bottom right-hand corner of the screen, so at the very end of the "new" method which instantiates my particular subclass of Frame I put

Code: Select all

  my $WxSize = Wx::GetDisplaySize();
  my $screen_width  = $WxSize->GetWidth();
  my $screen_height = $WxSize->GetHeight();
  my ($my_width, $my_height ) = $self->GetSizeWH();
  printf "Moving window to x=%d, y=%d\n", $screen_width-$my_width, $screen_height-$my_height;
  $self->Move( $screen_width-$my_width, $screen_height-$my_height );
When I run the application in a terminal the message "Moving window to x=1554, y=972" duly appears, but the window remains centred in the display, as it did before I added these lines of code.

Of course, it's me that's wrong and not the code; but where? All assistance gratefully received.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: "move" method of Frame has no effect

Post by doublemax »

I don't know about wxPerl, but looking at the sample code at http://examples.wxperl.it/, i'd say try putting that code after the Show() call for a test.
Use the source, Luke!
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: "move" method of Frame has no effect

Post by eranon »

If you move your window immediatly after creation (I mean, without need of extra work between the creation and the move), it would be easier to directly pass the position of the window to its constructor.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
Post Reply