This is on Linux. How can I tell which Wxperl build this is?
On Wed, 2012-02-08 at 21:29 -0200, Steve Cookson wrote:
> Hi Jeff,
>
> I tried it on Windows and couldn't see the problem you report. What O/s are
> you using.
>
> Regards
>
> Steve
>
>
>
> -----Original Message-----
> From: jeff [mailto:j...@roqc.no]
> Sent: 08 February 2012 20:39
> To: wxperl-users
> Cc: Cava Licensed Support
> Subject: [Fwd: wx::dialog and movexy broken?]
>
> One slight correction. That code on ~line 50 should be Movexy(100,100) -
> some folks might be use to seeing MoveXY, but both work and display the
> same odd behavior.
>
>
> -------- Forwarded Message --------
>
> Have some odd behavior here.
> Here is a test simple script. It simple opens and closes a non modal
> dialog by click a button on the main window.
>
> On the 1st click it will open the dialog at the requested location.
> Click the button a 2nd time and it will close.
> Click it a 3rd time and it will center on parent - hiding the main
> window.
> Move it aside.
> Click it a 4th time and it will close.
> Click it a 5th time and it will open at the requested location.
> And on and on., alternating between the two positions.
>
> The line of interest is ~ line 50.
> Having this behavior in many locations in real code :-(
>
> Anyone have any ideas? Hopefully we're just being stupid ;-)
>
> Jeff
>
> ##################################### CUT HERE
> #################################
> use strict;
> use Wx;
> ###########################################################
> #
> # Extend the Frame class to our needs
> #
> package MyFrame;
>
> use Wx::Event qw( EVT_BUTTON );
> use Wx qw/:everything/;
>
> use base qw/Wx::Frame/; # Inherit from Wx::Frame
>
> sub new
> {
> my $class = shift;
>
> my $self = $class->SUPER::new(@_); # call the superclass' constructor
>
> # Then define a Panel to put the button on
> my $panel = Wx::Panel->new( $self, # parent
> -1 # id
> );
>
> my $BTNID = 1; # store the id of the button in $BTNID
>
> $self->{btn} = Wx::Button->new( $panel, # parent
> $BTNID, # ButtonID
> ">>> Press me <<<", # label
> [50,50] # position
> );
>
> EVT_BUTTON( $self, # Object to bind to
> $BTNID, # ButtonID
> \&ButtonClicked # Subroutine to execute
> );
>
> $self->{dialog} = Wx::Dialog->new($self, -1, "test dialog");
> $self->{dialog_state}=0;
>
> return $self;
> }
>
> sub ButtonClicked
> {
> my( $self, $event ) = @_;
>
> if($self->{dialog_state}==0){
> $self->{dialog}->MoveXY
>
> (100, 100);
> $self->{dialog}->Show(1);
> $self->{dialog_state}=1;
> }
> else{
> $self->{dialog}->Show(0);
> $self->{dialog_state}=0;
> }
> }
>
> ###########################################################
> #
> # Define our ButtonApp2 class that extends Wx::App
> #
> package ButtonApp2;
>
> use base qw(Wx::App); # Inherit from Wx::App
>
> sub OnInit
> {
> my $self = shift;
> my $frame = MyFrame->new( undef, # Parent window
> -1, # Window id
> 'Button interaction example', # Title
> [300,400], # position X, Y
> [200, 150] # size X, Y
> );
> $self->SetTopWindow($frame); # Define the toplevel window
> $frame->Show(1); # Show the frame
> }
>
> ###########################################################
> #
> # The main program
> #
> package main;
>
> my $wxobj = ButtonApp2->new(); # New ButtonApp application
> $wxobj->MainLoop;
>
>
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
>
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________