Re: Strange appearance (MS Windows)

2010-02-28 Thread James McDonald

On 23/02/10 23:06, Johan Vromans wrote:

Hi,

The following (mostly wxGlade generated) program doesn't look native
to me. See screenshot.
I'm not very familiar with Wx on Windows, so I'm probably overlooking
something trivial.

Any pointers?

-- Johan



You have the background colour set incorrectly in wxGlade. Giving you 
that nasty dark gray


Re: Strange appearance (MS Windows)

2010-02-23 Thread Mark Dootson

Hi,

I don't recall if I read it in an instruction somewhere or not, but I 
have always regarded drawing controls directly onto a Wx::Frame as not 
working. I always just assumed that you need a container class 
(Wx::Panel or Wx::Notebook etc). Certainly, on MSWin you get the 
unexpected (as per your picture), as your control inherits attributes 
that match the background for the frame.


I don't know if it's a bug or undocumented 'feature', but it has always 
been this way as far as I know. My code always starts frames by putting 
a Wx::Panel in them to contain other controls - and then I get what I 
expect.


Regards

Mark


On 23/02/2010 12:06, Johan Vromans wrote:

Hi,

The following (mostly wxGlade generated) program doesn't look native
to me. See screenshot.
I'm not very familiar with Wx on Windows, so I'm probably overlooking
something trivial.

Any pointers?

-- Johan





Re: Strange appearance (MS Windows)

2010-02-23 Thread Johan Vromans
[Quoting Mark Dootson, on February 23 2010, 14:37, in Re: Strange appearan]
 I don't recall if I read it in an instruction somewhere or not, but I 
 have always regarded drawing controls directly onto a Wx::Frame as not 
 working. I always just assumed that you need a container class 
 (Wx::Panel or Wx::Notebook etc). Certainly, on MSWin you get the 
 unexpected (as per your picture), as your control inherits attributes 
 that match the background for the frame.
 
 I don't know if it's a bug or undocumented 'feature', but it has always 
 been this way as far as I know. My code always starts frames by putting 
 a Wx::Panel in them to contain other controls - and then I get what I 
 expect.

Yes, I seem to recall having heard something like this before.

Frame - Sizer - Panel - Sizer - Controls looks better,
Thanks!

-- Johan



Re: Strange appearance (MS Windows)

2010-02-23 Thread Johan Vromans
jvrom...@squirrel.nl (Johan Vromans) writes:

 Frame - Sizer - Panel - Sizer - Controls looks better,

Except that most of my controls no longer get their clicks...
(Windows only, works perfectly on Linux.)

Any suggestions?

-- Johan


Re: Strange appearance (MS Windows)

2010-02-23 Thread Mike Schroeder
Try putting down a Panel first, then your StaticBoxSizer on top of the
panel.



On Tue, Feb 23, 2010 at 5:06 AM, Johan Vromans jvrom...@squirrel.nl wrote:

 Hi,

 The following (mostly wxGlade generated) program doesn't look native
 to me. See screenshot.
 I'm not very familiar with Wx on Windows, so I'm probably overlooking
 something trivial.

 Any pointers?

 -- Johan




Re: Strange appearance (MS Windows)

2010-02-23 Thread Johan Vromans
[Quoting Mark Dootson, on February 23 2010, 15:52, in Re: Strange appearan]
 Something else going on.
 
 Crude change to x.pl attached - clicking on 'Hi' text gets a mouse event?

Yes.

BTW: The problem with the controls is a different application (as you
may expect).

  Frame
Controls (that work)
Panel 1
  TextCtrl
  Panel 2
Controls 2 (that work)

Now it is:

  Frame
Panel 0
  Controls (that work)
  Panel 1
TextCtrl
Panel 2
  Controls 2 (that do not work)

Reason is that the TextCtrl now gets focus and keeps focus, inhibiting
the controls 2 to work.

Hmm. Needs research.

-- Johan


Re: Strange appearance (MS Windows)

2010-02-23 Thread Mark Dootson

Something else going on.

Crude change to x.pl attached - clicking on 'Hi' text gets a mouse event?

On 23/02/2010 15:36, Johan Vromans wrote:

jvrom...@squirrel.nl (Johan Vromans) writes:


Frame -  Sizer -  Panel -  Sizer -  Controls looks better,


Except that my controls no longer get clicks :(

-- Johan
#!/usr/bin/perl -w -- 
# generated by wxGlade 8a5c6ed2b841 on Tue Feb 23 12:44:36 2010
# To get wxPerl visit http://wxPerl.sourceforge.net/

use Wx 0.15 qw[:allclasses];
use strict;

package MyFrame;

use Wx qw[:everything];
use base qw(Wx::Frame);
use strict;
use Wx::Event qw( EVT_LEFT_DOWN );

sub new {
my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_;
$parent = undef  unless defined $parent;
$id = -1 unless defined $id;
$title  =  unless defined $title;
$pos= wxDefaultPosition  unless defined $pos;
$size   = wxDefaultSize  unless defined $size;
$name   =  unless defined $name;

# begin wxGlade: MyFrame::new

$style = wxDEFAULT_FRAME_STYLE 
unless defined $style;

$self = $self-SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
$self-{panel} = Wx::Panel-new($self, -1);
$self-{sizer_3_staticbox} = Wx::StaticBox-new($self-{panel}, -1,  );


# Menu Bar

$self-{frame_1_menubar} = Wx::MenuBar-new();
my $wxglade_tmp_menu;
$self-{Exit} = Wx::Menu-new();
$self-{frame_1_menubar}-Append($self-{Exit}, item);
$self-SetMenuBar($self-{frame_1_menubar});

# Menu Bar end

$self-{label_1} = Wx::StaticText-new($self-{panel}, -1, Hi, wxDefaultPosition, wxDefaultSize, );

$self-__set_properties();
$self-__do_layout();

EVT_LEFT_DOWN($self-{label_1}, \OnEventCheck);

# end wxGlade
return $self;

}

sub OnEventCheck {
  my ($label, $event) = @_;
  $event-Skip(1);
  Wx::LogMessage('Event Click');
}


sub __set_properties {
my $self = shift;

# begin wxGlade: MyFrame::__set_properties

$self-SetTitle(frame_1);
$self-SetSize(Wx::Size-new(194, 90));

# end wxGlade
}

sub __do_layout {
my $self = shift;

# begin wxGlade: MyFrame::__do_layout

$self-{sizer_1} = Wx::BoxSizer-new(wxVERTICAL);
$self-{sizer_2} = Wx::BoxSizer-new(wxHORIZONTAL);
$self-{sizer_3}= Wx::StaticBoxSizer-new($self-{sizer_3_staticbox}, wxHORIZONTAL);
$self-{sizer_3}-Add($self-{label_1}, 0, wxEXPAND|wxADJUST_MINSIZE, 0);
$self-{sizer_2}-Add($self-{sizer_3}, 1, wxEXPAND, 0);
$self-{sizer_1}-Add($self-{sizer_2}, 1, wxEXPAND, 0);
$self-SetSizer($self-{sizer_1});
$self-Layout();

# end wxGlade
}

# end of class MyFrame

package MyApp;

use base qw(Wx::App);

sub OnInit {
my $dialog_1 = MyFrame-new();
$dialog_1-Show(1);
return 1;
}

package main;

my $app = MyApp-new;
$app-MainLoop;



Re: Strange appearance (MS Windows)

2010-02-23 Thread Mark Dootson

Hi - this may appear twice - mail client problems.

Something else going on.

Crude change to x.pl attached - clicking on 'Hi' text gets a mouse event?

On 23/02/2010 15:36, Johan Vromans wrote:

jvrom...@squirrel.nl (Johan Vromans) writes:


Frame -  Sizer -  Panel -  Sizer -  Controls looks better,


Except that my controls no longer get clicks :(

-- Johan


#!/usr/bin/perl -w -- 
# generated by wxGlade 8a5c6ed2b841 on Tue Feb 23 12:44:36 2010
# To get wxPerl visit http://wxPerl.sourceforge.net/

use Wx 0.15 qw[:allclasses];
use strict;

package MyFrame;

use Wx qw[:everything];
use base qw(Wx::Frame);
use strict;
use Wx::Event qw( EVT_LEFT_DOWN );

sub new {
my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_;
$parent = undef  unless defined $parent;
$id = -1 unless defined $id;
$title  =  unless defined $title;
$pos= wxDefaultPosition  unless defined $pos;
$size   = wxDefaultSize  unless defined $size;
$name   =  unless defined $name;

# begin wxGlade: MyFrame::new

$style = wxDEFAULT_FRAME_STYLE 
unless defined $style;

$self = $self-SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
$self-{panel} = Wx::Panel-new($self, -1);
$self-{sizer_3_staticbox} = Wx::StaticBox-new($self-{panel}, -1,  );


# Menu Bar

$self-{frame_1_menubar} = Wx::MenuBar-new();
my $wxglade_tmp_menu;
$self-{Exit} = Wx::Menu-new();
$self-{frame_1_menubar}-Append($self-{Exit}, item);
$self-SetMenuBar($self-{frame_1_menubar});

# Menu Bar end

$self-{label_1} = Wx::StaticText-new($self-{panel}, -1, Hi, wxDefaultPosition, wxDefaultSize, );

$self-__set_properties();
$self-__do_layout();

EVT_LEFT_DOWN($self-{label_1}, \OnEventCheck);

# end wxGlade
return $self;

}

sub OnEventCheck {
  my ($label, $event) = @_;
  $event-Skip(1);
  Wx::LogMessage('Event Click');
}


sub __set_properties {
my $self = shift;

# begin wxGlade: MyFrame::__set_properties

$self-SetTitle(frame_1);
$self-SetSize(Wx::Size-new(194, 90));

# end wxGlade
}

sub __do_layout {
my $self = shift;

# begin wxGlade: MyFrame::__do_layout

$self-{sizer_1} = Wx::BoxSizer-new(wxVERTICAL);
$self-{sizer_2} = Wx::BoxSizer-new(wxHORIZONTAL);
$self-{sizer_3}= Wx::StaticBoxSizer-new($self-{sizer_3_staticbox}, wxHORIZONTAL);
$self-{sizer_3}-Add($self-{label_1}, 0, wxEXPAND|wxADJUST_MINSIZE, 0);
$self-{sizer_2}-Add($self-{sizer_3}, 1, wxEXPAND, 0);
$self-{sizer_1}-Add($self-{sizer_2}, 1, wxEXPAND, 0);
$self-SetSizer($self-{sizer_1});
$self-Layout();

# end wxGlade
}

# end of class MyFrame

package MyApp;

use base qw(Wx::App);

sub OnInit {
my $dialog_1 = MyFrame-new();
$dialog_1-Show(1);
return 1;
}

package main;

my $app = MyApp-new;
$app-MainLoop;




Re: Strange appearance (MS Windows)

2010-02-23 Thread Johan Vromans
[Quoting Mark Dootson, on February 23 2010, 16:13, in Re: Strange appearan]
 I would guess wxTAB_TRAVERSAL as a panel style is the answer?

Nah, that would be much too easy...

   Panel 0
 Controls (that work)
 Panel 1
   TextCtrl
   Panel 2
 Controls 2 (that do not work)
 
  Reason is that the TextCtrl now gets focus and keeps focus, inhibiting
  the controls 2 to work.

Panel 2 is dynamically generated and activated with sizer-Replace .
I think that somehow blocks the flow of events (although I can't tell
why).

If you have some spare time to take a look at the app I would
appreciate it very much.

-- Johan