Topic: Bugs with addGUIElement
Hello, please, help me I'm dont know - this is my error or bug with Irrlicht?
Type TGUI
Field element:IGUIElement, element_name:String
Field button:IGUIButton[16] , checkbox:IGUICheckBox[16] , colorselectdialog:IGUIColorSelectDialog
Field combobox:IGUIComboBox[4] , contextmenu:IGUIContextMenu[2] , editbox:IGUIEditBox[16]
Field fileopendialog:IGUIFileOpenDialog, image:IGUIImage[32] , inoutfader:IGUIInOutFader[4]
Field listbox:IGUIListBox[4] , meshviewer:IGUIMeshViewer[2] , scrollbar:IGUIScrollBar[4]
Field statictext:IGUIStaticText[32] , tab:IGUITab[4] , tabcontrol:IGUITabControl[4]
Field toolbar:IGUIToolBar[2] , iwindow:IGUIWindow[2]
EndType
Global TGUI_list:TList = New TList
Function Generate_GUI(file_url:String, name_element:String)
Local button_var:Int
Local gui:TGUI = New TGUI
TGUI_list.AddLast gui
gui.element_name = name_element:String
gui.element = env.addGUIElement(gui.element_name)
If gui.element = Null
DebugLog gui.element_name + " ^ Null"
EndIf
gui.element.setMinSize(_DIMENSION2DI(app_vars:Int[graphics_width] , app_vars:Int[graphics_height] ))
Local xml:TXml = New TXml
TXml_list.Addlast xml
xml.file:IXMLReaderUTF8 = current_filesystem.createXMLReaderUTF8(file_url:String)
While xml.file.read()
Select xml.file.getNodeType()
Case EXN_ELEMENT
Select xml.file.getNodeName()
Case "gui"
Select xml.file.getAttributeValue("type_gui")
Case "button"
button_var:+1
gui.button[button_var] = env.addButton(_RECTI(Int(xml.file.getAttributeValue("x1")), Int(xml.file.getAttributeValue("y1")), Int(xml.file.getAttributeValue("x2")), Int(xml.file.getAttributeValue("y2"))), gui.element, Int(xml.file.getAttributeValue("id")), xml.file.getAttributeValue("text"), xml.file.getAttributeValue("tooltip"))
DebugLog "button"
Default
endselect
xml.nodename:String = xml.file.getNodeName()
End Select
Case EXN_TEXT
Select xml.nodename:String
Case "gui"
DebugLog xml.file.getNodeData()
End Select
End Select
Wend
TXml_list.remove(xml)
EndFunction
On this line:
gui.element.setMinSize(_DIMENSION2DI(app_vars:Int[graphics_width] , app_vars:Int[graphics_height] ))
show this error:
Compiling:main.bmx flat assembler version 1.67.23 (316651 kilobytes memory)
4 passes, 0.1 seconds, 56317 bytes.
Linking:main.exe Irrlicht Engine version 1.3.1
Microsoft Windows XP Professional Service Pack 2 (Build 2600)
Using renderer: Direct3D 9.0
S3 Graphics Savage/IX 1014 s3gsavmx.dll 6.13.10.7050
DebugLog:test ^ Null
--?BlitzMax Debug Report:
Unhandled Exception:Attempt to access field or method of Null object