Attempt to access field or method of Null object
BlitzMax Forums/BlitzMax Beginners Area/Attempt to access field or method of Null object
| ||
SuperStrict Framework brl.System Import maxgui.Drivers Import brl.EventQueue Import brl.PolledInput Import brl.Max2D Global Wello:TGadget = CreateWindow(AppTitle, 100, 100, 320, 240) Global Sub_Wello:TGadget = CreateWindow("SUB", 430, 100, 320, 240, Wello, 1) Global Tello:TGadget = CreateCanvas(0, 0, ClientWidth(Sub_Wello), ClientHeight(Sub_Wello), Sub_Wello) ' NOT OK 'Global Tello:TGadget = CreateTextArea(0, 0, ClientWidth(Sub_Wello), ClientHeight(Sub_Wello), Sub_Wello) ' OK Rem I can CreateTextArea but CreateCanvas give this ERROR: AttachGraphics failed:Attempt to access field or method of Null object, What I do wrong? End Rem Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE ' [X] :: Quit Application If EventSource() = Wello Then Print "CLOSE :: Wello" End Else Print "CLOSE :: Sub_Wello" FreeGadget Sub_Wello End If End Select Forever |
| ||
Sorry I didn't include:Import brl.d3d9max2dWhat is recommended if I want to do 2D tiles? glmax2d or d3d9max2d? Or is there alternatives? |
| ||
It's hard to know what you need to import with Framework. It's easier to let BlitzMax use the default "everything" method. Once have a working program you can let Framework Assistant sort it out. Edit: Don't know about the 2D tiles. If it's just for Windows then I would guess use D3D unless you have a good reason not to. SuperStrict Import maxgui.Drivers Global Wello:TGadget = CreateWindow(AppTitle, 100, 100, 320, 240) Global Sub_Wello:TGadget = CreateWindow("SUB", 430, 100, 320, 240, Wello, 1) Global Tello:TGadget = CreateCanvas(0, 0, ClientWidth(Sub_Wello), ClientHeight(Sub_Wello), Sub_Wello) ' NOT OK 'Global Tello:TGadget = CreateTextArea(0, 0, ClientWidth(Sub_Wello), ClientHeight(Sub_Wello), Sub_Wello) ' OK Rem I can CreateTextArea but CreateCanvas give this ERROR: AttachGraphics failed:Attempt to access field or method of Null object, What I do wrong? End Rem Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE ' [X] :: Quit Application If EventSource() = Wello Then Print "CLOSE :: Wello" End Else Print "CLOSE :: Sub_Wello" FreeGadget Sub_Wello End If End Select Forever |
| ||
You're better off not using Framework/Import at all, at first. Just get stuff working, then use Framework Assistant later. |