wxCodegen BUG

BlitzMax Forums/Brucey's Modules/wxCodegen BUG

Henri(Posted 2014) [#1]
Hello Brucey,

found a bug in wxCodegen app. If you define any graphic source (LoadFromFile) for tool in toolbar using wxFormbuilder you get "array index out of bounds"-error.

It seems that this is the culprit:
Method DoBitmap:String(bm:String)

		Local text:String = ""
		
		Local bitmap:String[] = bm.Split(";")
		
		'*** EDIT *** Changed from bitmap[0] to bitmap[1]
		If bitmap[1] Then
			text:+ "wxBitmap.CreateFromFile(~q" + bitmap[1] + "~q, "
			
			Local kind:String = bitmap[1].Split(".")[1].ToUpper()
			Select kind
				Case "PNG"
					text:+ "wxBITMAP_TYPE_PNG"
				Default
					text:+ "wxBITMAP_TYPE_ANY"
			End Select
			
			text:+ ")"
		Else
			text = "Null"
		End If
		
		Return text
	
	End Method

Bitmap[0] holds value "LoadFromFile" and bitmap[1] holds the actual path so bitmap[0].Split(".") returns an array of only size 1.

-Henri