wxImageList.GetIcon() not returning anything

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

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)