From: Mattia B. <mb...@ds...> - 2002-07-23 20:24:06
|
[sorry for the late answer, I was away] > If anyone could give me some advice on this, I'd really appreciate it. I'm > trying to load a windows system icon so that I can later draw it with > *DC::DrawIcon. Wich wxPerl version? I gather OS is Win32. You should always mention OS & wxPerl version. Thanks! > This code: > $this->{icon} = Wx::Icon->new(wxICON_QUESTION, > wxBITMAP_TYPE_ICO_RESOURCE); > > Dies with an error to saying that wxPerl cannot find the overloaded function > (I've tried several other variations on this as well, from the wxWindows > online docs). Were did you find that example? To load a system icon you should use $myapp->GetStadIcon( wxICON_XXX ); > However, if I just do: > > $this->{icon} = Wx::Icon->new(); > $this->{icon}->LoadFile(wxICON_QUESTION, wxBITMAP_TYPE_ICO_RESOURCE); > > It doesn't die. But if you call $this->{icon}->Ok it will probably fail. > But then when I go to draw it: > > sub OnPaint { > my ($this, $event) = @_; > my $dc = Wx::PaintDC->new($this); > $dc->DrawIcon($this->{icon}); > } > > It crashes when it gets to DrawIcon. It should also print an error that you should use $dc->DrawIcon( $icon, $x, $y ), though. Doesn't it? HTH Mattia |