SuperStrict Global GAME_WIDTH:Int=800 Global GAME_HEIGHT:Int=600 Local wx:Int=(GadgetWidth(Desktop())-GAME_WIDTH)/2 Local wy:Int=(GadgetHeight(Desktop())-GAME_HEIGHT)/2 Global MainWindow:TNewWindow = New TNewWindow MainWindow.Create("The Main Window",wx,wy,GAME_WIDTH,GAME_HEIGHT,MainWindow) Global newcanvas:Tgadget= CreateCanvas(0,0,ClientWidth(Mainwindow.Tgad),ClientHeight(Mainwindow.Tgad),Mainwindow.Tgad) Repeat Mainwindow.UpdateState() Until AppTerminate() End Type TMyGadget Field Tgad:TGadget Field Tgadx:Int Field Tgady:Int Field Tgadh:Int Field Tgadw:Int Field TgadParent:Tgadget 'Method UpdateState() Abstract End Type Type TNewWindow Extends TMyGadget Method Create(wCaption:String,wX:Int,wY:Int,wWidth:Int,wHeight:Int,wParent:TNewWindow) Tgad= CreateWindow(wCaption,wX,wY,wWidth,wHeight,,WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_MENU | WINDOW_STATUS) 'Local text$= "My current size (w,h) is " + ClientWidth(Tgad)+ "," + ClientHeight(Tgad) 'SetStatusText Tgad, text$ End Method Method UpdateState() 'AddHook EmitEventHook, Mainhook WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE ' FreeGadget TileCanvas End ' Case EVENT_WINDOWSIZE ' ' ResizeWindows ' Case EVENT_MOUSEMOVE ' Case EVENT_GADGETPAINT ' SetGraphics CanvasGraphics(Maincanvas) ' SetViewport 0, 0, ClientWidth(Mainwindow), ClientHeight(Mainwindow) ' Cls Case EVENT_APPTERMINATE End End Select 'Flip End Method
Issue inheriting TGadget properties
BlitzMax Forums/BlitzMax GUI Programming/Issue inheriting TGadget propertiesThe 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.