Why does this crash? Converting wxImage-wxBitmap

BlitzMax Forums/Brucey's Modules/Why does this crash? Converting wxImage-wxBitmap

rs22(Posted 2009) [#1]
Hi,

I am trying to convert a wxImage to wxBitmap, but the code I'm using crashes:
Local pngImg:wxImage = New wxImage wxImage.CreateFromFile("computer.png", wxBITMAP_TYPE_PNG)
		
local pngBmp:wxBitmap = New wxBitmap.CreateFromImage(pngImg)

Any ideas why? Any help would be most appreciated!

Thanks!


Brucey(Posted 2009) [#2]
is this a typo in your post?
Local pngImg:wxImage = New wxImage wxImage.CreateFromFile("computer.png", wxBITMAP_TYPE_PNG)


Should be
Local pngImg:wxImage = wxImage.CreateFromFile("computer.png", wxBITMAP_TYPE_PNG)


CreateFromFile is a Function... (as opposed to a method). I know it can be a little confusing with all these different ways of creating objects.