Hi Daniel,
I don't know what GetWordPicture etc refers to, I assume it is a function in
that user's code that returns a Wx::StaticBitmap.
To use Wx::StaticBitmap add it to your GUI and call SetBitmap on it.
Unfortunately according to the docs this is not meant to me a general purpose
image display control. I have not tested how important this warning is...
If you heed that warning the simplest way I know of displaying a bitmap is to
use a Wx::DC object so if you want to draw a picture on a Wx::Panel, $panel,
do something like:
#initialise all the image handlers
Wx::InitAllImageHandlers();
#load the image
my $wxbitmap = Wx::Bitmap->new("myimage.png",wxBITMAP_TYPE_PNG);
#Get a dc object
$drawArea = Wx::ClientDC->new($panel);
#Draw the bitmap
$drawArea->DrawBitmap($wxbitmap,0,0,0);
You may also want to register the painting event so that the image is redrawn
on a repaint. eg:
Add this to your initialisation code:
#Register the painting event
Wx::Event::EVT_PAINT($panel, \&OnPaint);
Create a OnPaint routine that goes something like:
sub OnPaint {
my ($self, $event) = @_;
my $drawArea;
#Depending whether the event is being called due to a repaint or
# change in content (eg. image) we use different DC objects. Unsure
# how important this really is
if (defined $event)
{
$drawArea = Wx::PaintDC->new($self);
} else {
$drawArea = Wx::ClientDC->new($self );
}
#DRAW STUFF IN HERE! (eg. previous code for drawing a bitmap)
if (defined $event) { $event->Skip(); }
}
This is just how I do it though, and is probably not the best way but it works
for me.
Best wishes & good luck!
Klaas
On Mon, 30 Jul 2007 19:14:54 Daniel wrote:
> Hi all,
>
> does anyone have a sample script that simply shows a picture?
>
> I found something like that, but don't know what GetWordPicture() do.
>
> my $logo="LOGO.gif";
> my $image=Wx::Bitmap->new( Wx::Image->new( $logo, wxBITMAP_TYPE_ANY) );
> my $bitmap_widget=GetWordPicture($self); # this gets the address of the
> static bitmap $bitmap_widget->SetBitmap($image);
>
>
> Thanks,
> Daniel
>
>
>
>
> __________________________________ Wissenswertes zum Thema PC,
> Zubehör oder Programme. BE A BETTER INTERNET-GURU! www.yahoo.de/clever