I'm trying to add a map to my GUI, but I've run into a problem... Its giving me the usual error.
Unhandled Exception:Attempt to access field or method of Null objectBut its reporting it on _max2dDriver.Cls within Cls().
'This BMX file was edited with BLIde ( <a href="http://www.blide.org" target="_blank">http://www.blide.org</a> ) SuperStrict Module ncg.io_gui ModuleInfo "Name: EoN IO" ModuleInfo "Description: Engine of New Creation IO Module" ModuleInfo "License: " ModuleInfo "Authors: New Creation Games" ModuleInfo "CustomAttr:" Import brl.Win32MaxGUI Import brl.RamStream Import BRL.BMPLoader Import brl.EventQueue Import brl.max2d 'Import maxgui.drivers Import brl.PNGLoader Import brl.TGALoader Import brl.JPGLoader Global MainWindow:TGadget = CreateWindow("Main", 100, 100, 800, 600, Null, WINDOW_TITLEBAR) 'Global Map:TImage = LoadImage(AppDir + "/Map.bmp") Global Map_Canvas:TGadget = CreateCanvas(0, 460, 100, 100, MainWindow) Global InLabel:TGadget = CreateLabel("", 200, 0, 590, 20, MainWindow, LABEL_CENTER) Global InBox:TGadget = CreateListBox(200, 20, 590, 400, MainWindow) Global InfoPanel:TGadget = CreatePanel(0, 0, 200, 120, MainWindow, PANEL_BORDER) Global NameLabel:TGadget = CreateLabel("Name: Sjoerd Daniel Maximus the Third", 0, 0, 200, 20, InfoPanel) Global LocationLabel:TGadget = CreateLabel("Location: Council Chambers", 0, 20, 200, 20, InfoPanel) Global AimLabel:TGadget = CreateLabel("Aim: 70%", 0, 40, 200, 20, InfoPanel) Global AvoidLabel:TGadget = CreateLabel("Avoid: 30%", 0, 60, 200, 20, InfoPanel) Global WeaponLabel:TGadget = CreateLabel("Weapon: E-11 Blaster Rifle", 0, 80, 200, 20, InfoPanel) Global LifeLabel:TGadget = CreateLabel("Life:", 0, 100, 200, 20, InfoPanel) Global InfoLog:TGadget = CreateListBox(200, 420, 590, 100, MainWindow) Function In:String(Msg:String, Map:TImage, IsChoice:Int = True, Choices:TList) Local Temp_String:String Local ExitTime:Int = False InBox.Clear() For Temp_String = EachIn Choices AddGadgetItem(InBox, Temp_String) Next SetGadgetText(InLabel, MSG) RedrawGadget(Map_Canvas) While Not ExitTime = True WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_GADGETACTION If SelectedGadgetItem(InBox) <> - 1 ExitTime = True End If Case EVENT_GADGETPAINT SetGraphics(CanvasGraphics(Map_Canvas)) Cls DrawImage(Map, 0, 0) Flip End Select Wend Return GadgetItemText(InBox, SelectedGadgetItem(InBox)) End Function