wxImageList.GetIcon() not returning anything

BlitzMax Modules Forums/Brucey's Modules/wxImageList.GetIcon() not returning anything

The below example demonstrates that wxImageList.GetIcon() returns NULL:

SuperStrict
Framework wx.wxApp
Import wx.wxFrame
Import wx.wxImage
Import wx.wxIcon
Import wx.wxImageList

Type MyApp Extends wxApp
	Field Frame:wxFrame
	
	Method OnInit:Int() 
		Frame = wxFrame.CreateFrame(,, "Icon test", 100, 100) 
		wxImage.AddHandler(New wxXPMHandler) 
		
		Local imageList:wxImageList = New wxImageList.Create(15, 15, True) 
		imageList.AddIcon(wxIcon.CreateFromFile("icon.xpm")) 
		Local icon:wxIcon = New wxIcon.Create() 
		icon = imageList.GetIcon(0) 
		If Not icon Then RuntimeError("No icon!") 
		Frame.SetIcon(icon) 
		Frame.show() 
		Return True
	End Method
	
End Type

New MyApp.Run() 



The example works fine when loading the icon directly using
Icon.LoadFile("icon.xpm", wxBITMAP_TYPE_XPM)


http://code.google.com/p/wxmax/wiki/ToDo :-)

I'll have a look at finishing off wxImageList.

Ah, that figures!

Next time I'd better check the ToDo list before posting another "bug report" ;)

I think I can work myself around the issue by using an array of bitmaps instead and converting them to icons on-the-fly.

Thank you for your hard work, though! =)

Done.

Revision 388 :-)

Fine, but could you please be a little faster next time? ;)

Incredible. I just wired you a little something via Paypal.

Heck, I'm using four of your modules in my game project, not to mention the various Blitz stuff I'm doing at work so this is the least I could do. =)

but could you please be a little faster next time?

Apologies... I would have committed it sooner, but I was distracted by dinner ;-)

Thanks very much!