Re: Can you display a bitmap with/inside of a sizer?

2015-05-07 Thread Steve Cookson

Hi James,

Well really I find sizers are a bit problematic too.  At the beginning I 
did them just as you are doing.  Then I started drawing the more 
complicated ones out on a piece of paper before starting and now I have 
a standard layout which I reuse so that I have a standard header, a main 
panel and a standard footer with a standard set of buttons in it.  The 
main panel still requires some thinking, but I would have used the 
nested sizers idea that you used. Wx::GridBagSizer is a bit more 
complicated, but would also have worked, that way you might have been 
able to do the whole thing with one sizer.


Regarding the memory leak, I thought I had it.  I made a number of 
changes to make the code more streamlined and efficient and lo and 
behold the leak disappeared only to pop up else where.


It's driving me a bit crazier than I was anyway, and worse, I don't even 
know if it's causing the video crash!  Any suggestions welcome!


Thanks for asking,

Steve.

On 06/05/15 23:39, James Lynes wrote:

Solved... via trial and error and error and error...

Made the top level sizer horizontal, containing a left and right 
vertical, containing text controls, bitmap, and buttons.


Will post once I add a few more bells and whistles.

Thanks again,

James


On Wed, May 6, 2015 at 4:06 PM, James Lynes jmlyne...@gmail.com 
mailto:jmlyne...@gmail.com wrote:


Steve, thanks! Did the job.

But, of course, one question leads to at least one more.

I would like the bitmap to be displayed to the right of a column
of TextCtrls. Currently the TextCtrls are being displayed under
the bitmap now that I'm not using an onPaint event . Do I need to
create two sub-panels with sub-sizers, one for the bitmap and one
for the TextCtrls? Or should the top sizer be a horzontal rather
than vertical? Trying to make some sense of this sizer stuff.

James

PS: Did you find your memory leak?

On Mon, May 4, 2015 at 11:32 AM, Steve Cookson
steve.cook...@sca-uk.com mailto:steve.cook...@sca-uk.com wrote:

Hi James,

You want Wx::StaticBitmap, like this:

my $bmp = Wx::Bitmap-new(path/to/bitmap.png,
wxBITMAP_TYPE_PNG) ;
my $sbm = Wx::StaticBitmap-new($parent, wxID_ANY, $bmp,
wxDefaultPosition, wxDefaultSize, );
$sizer-Add($sbm, 0, 0, 0);

Regards

Steve.



On 02/05/15 16:05, James Lynes wrote:

Good day!

I'm working on a little app to design common emitter
amplifiers. I created a circuit schematic with Eagle and
exported it to a PNG file.

I am currently displaying the PNG at a fixed location of
the screen with:

Wx::Event::EVT_PAINT($self, sub {
my ($self, $event) = @_;
My $dc = Wx::PaintDC-new($self);
my $bmp = Wx::Bitmap-new(CEAmpImg.png,
wxBITMAP_TYPE_PNG);
$dc-DrawBitmap($bmp, 150, 50, 1);});

If would be nice if I could blend this in with the sizers
that are controlling the layout of the input and output
TextCtrls.

Thanks for your ideas.

James









Re: Can you display a bitmap with/inside of a sizer?

2015-05-07 Thread James Lynes
Steve:

You are already beyond me on looking for the memory leak based on your PM
post. The wxBook has a section on finding memory leaks, but what you are
doing with Valgrind is probably more advanced. Wish I could help more...

I like your idea for a standard layout - Header/Main/Footer. I need to work
that into my new app boiler plate file.  It's amazing how many lines are
required for the sizers! Getting there. It makes more sense now that I have
it working. Nice to have example code to look at. Need to get github set up
on this laptop so I can add this to my examples repository.

For what it's worth, attached is my latest learning exercise.

James




On Thu, May 7, 2015 at 3:02 AM, Steve Cookson steve.cook...@sca-uk.com
wrote:

  Hi James,

 Well really I find sizers are a bit problematic too.  At the beginning I
 did them just as you are doing.  Then I started drawing the more
 complicated ones out on a piece of paper before starting and now I have a
 standard layout which I reuse so that I have a standard header, a main
 panel and a standard footer with a standard set of buttons in it.  The main
 panel still requires some thinking, but I would have used the nested sizers
 idea that you used.  Wx::GridBagSizer is a bit more complicated, but would
 also have worked, that way you might have been able to do the whole thing
 with one sizer.

 Regarding the memory leak, I thought I had it.  I made a number of changes
 to make the code more streamlined and efficient and lo and behold the leak
 disappeared only to pop up else where.

 It's driving me a bit crazier than I was anyway, and worse, I don't even
 know if it's causing the video crash!  Any suggestions welcome!

 Thanks for asking,

 Steve.


 On 06/05/15 23:39, James Lynes wrote:

   Solved... via trial and error and error and error...

  Made the top level sizer horizontal, containing a left and right
 vertical, containing text controls, bitmap, and buttons.

  Will post once I add a few more bells and whistles.

  Thanks again,

  James


 On Wed, May 6, 2015 at 4:06 PM, James Lynes jmlyne...@gmail.com wrote:

   Steve, thanks! Did the job.

  But, of course, one question leads to at least one more.

  I would like the bitmap to be displayed to the right of a column of
 TextCtrls. Currently the TextCtrls are being displayed under the bitmap now
 that I'm not using an onPaint event . Do I need to create two sub-panels
 with sub-sizers, one for the bitmap and one for the TextCtrls? Or should
 the top sizer be a horzontal rather than vertical? Trying to make some
 sense of this sizer stuff.

  James

  PS: Did you find your memory leak?

 On Mon, May 4, 2015 at 11:32 AM, Steve Cookson steve.cook...@sca-uk.com
 wrote:

 Hi James,

 You want Wx::StaticBitmap, like this:

 my $bmp = Wx::Bitmap-new(path/to/bitmap.png, wxBITMAP_TYPE_PNG) ;
 my $sbm = Wx::StaticBitmap-new($parent, wxID_ANY, $bmp,
 wxDefaultPosition, wxDefaultSize, );
 $sizer-Add($sbm, 0, 0, 0);

 Regards

 Steve.



 On 02/05/15 16:05, James Lynes wrote:

 Good day!

 I'm working on a little app to design common emitter amplifiers. I
 created a circuit schematic with Eagle and exported it to a PNG file.

 I am currently displaying the PNG at a fixed location of the screen
 with:

 Wx::Event::EVT_PAINT($self, sub {
 my ($self, $event) = @_;
 My $dc = Wx::PaintDC-new($self);
 my $bmp = Wx::Bitmap-new(CEAmpImg.png, wxBITMAP_TYPE_PNG);
 $dc-DrawBitmap($bmp, 150, 50, 1);});

 If would be nice if I could blend this in with the sizers that are
 controlling the layout of the input and output TextCtrls.

 Thanks for your ideas.

 James









CEAmp1.pl
Description: Perl program


CEAmp.pm
Description: Perl program


Re: Can you display a bitmap with/inside of a sizer?

2015-05-06 Thread James Lynes
Steve, thanks! Did the job.

But, of course, one question leads to at least one more.

I would like the bitmap to be displayed to the right of a column of
TextCtrls. Currently the TextCtrls are being displayed under the bitmap now
that I'm not using an onPaint event . Do I need to create two sub-panels
with sub-sizers, one for the bitmap and one for the TextCtrls? Or should
the top sizer be a horzontal rather than vertical? Trying to make some
sense of this sizer stuff.

James

PS: Did you find your memory leak?

On Mon, May 4, 2015 at 11:32 AM, Steve Cookson steve.cook...@sca-uk.com
wrote:

 Hi James,

 You want Wx::StaticBitmap, like this:

 my $bmp = Wx::Bitmap-new(path/to/bitmap.png, wxBITMAP_TYPE_PNG) ;
 my $sbm = Wx::StaticBitmap-new($parent, wxID_ANY, $bmp,
 wxDefaultPosition, wxDefaultSize, );
 $sizer-Add($sbm, 0, 0, 0);

 Regards

 Steve.



 On 02/05/15 16:05, James Lynes wrote:

 Good day!

 I'm working on a little app to design common emitter amplifiers. I
 created a circuit schematic with Eagle and exported it to a PNG file.

 I am currently displaying the PNG at a fixed location of the screen with:

 Wx::Event::EVT_PAINT($self, sub {
 my ($self, $event) = @_;
 My $dc = Wx::PaintDC-new($self);
 my $bmp = Wx::Bitmap-new(CEAmpImg.png, wxBITMAP_TYPE_PNG);
 $dc-DrawBitmap($bmp, 150, 50, 1);});

 If would be nice if I could blend this in with the sizers that are
 controlling the layout of the input and output TextCtrls.

 Thanks for your ideas.

 James






Re: Can you display a bitmap with/inside of a sizer?

2015-05-06 Thread James Lynes
Solved... via trial and error and error and error...

Made the top level sizer horizontal, containing a left and right vertical,
containing text controls, bitmap, and buttons.

Will post once I add a few more bells and whistles.

Thanks again,

James


On Wed, May 6, 2015 at 4:06 PM, James Lynes jmlyne...@gmail.com wrote:

 Steve, thanks! Did the job.

 But, of course, one question leads to at least one more.

 I would like the bitmap to be displayed to the right of a column of
 TextCtrls. Currently the TextCtrls are being displayed under the bitmap now
 that I'm not using an onPaint event . Do I need to create two sub-panels
 with sub-sizers, one for the bitmap and one for the TextCtrls? Or should
 the top sizer be a horzontal rather than vertical? Trying to make some
 sense of this sizer stuff.

 James

 PS: Did you find your memory leak?

 On Mon, May 4, 2015 at 11:32 AM, Steve Cookson steve.cook...@sca-uk.com
 wrote:

 Hi James,

 You want Wx::StaticBitmap, like this:

 my $bmp = Wx::Bitmap-new(path/to/bitmap.png, wxBITMAP_TYPE_PNG) ;
 my $sbm = Wx::StaticBitmap-new($parent, wxID_ANY, $bmp,
 wxDefaultPosition, wxDefaultSize, );
 $sizer-Add($sbm, 0, 0, 0);

 Regards

 Steve.



 On 02/05/15 16:05, James Lynes wrote:

 Good day!

 I'm working on a little app to design common emitter amplifiers. I
 created a circuit schematic with Eagle and exported it to a PNG file.

 I am currently displaying the PNG at a fixed location of the screen with:

 Wx::Event::EVT_PAINT($self, sub {
 my ($self, $event) = @_;
 My $dc = Wx::PaintDC-new($self);
 my $bmp = Wx::Bitmap-new(CEAmpImg.png, wxBITMAP_TYPE_PNG);
 $dc-DrawBitmap($bmp, 150, 50, 1);});

 If would be nice if I could blend this in with the sizers that are
 controlling the layout of the input and output TextCtrls.

 Thanks for your ideas.

 James







Can you display a bitmap with/inside of a sizer?

2015-05-02 Thread James Lynes
Good day!

I'm working on a little app to design common emitter amplifiers. I created
a circuit schematic with Eagle and exported it to a PNG file.

I am currently displaying the PNG at a fixed location of the screen with:

Wx::Event::EVT_PAINT($self, sub {
my ($self, $event) = @_;
My $dc = Wx::PaintDC-new($self);
my $bmp = Wx::Bitmap-new(CEAmpImg.png, wxBITMAP_TYPE_PNG);
$dc-DrawBitmap($bmp, 150, 50, 1);});

If would be nice if I could blend this in with the sizers that are
controlling the layout of the input and output TextCtrls.

Thanks for your ideas.

James