Hi All,
I am trying to write a custom gadget using a simiar event model to the one below.
But I can only get one of them to work at a time. If I create more than one instance, either the application will exit without a word (in Debug Build), or only one of the works (Non Debug).
Should I post it in the Bug forum, or am I doing something silly?
I am trying to write a custom gadget using a simiar event model to the one below.
But I can only get one of them to work at a time. If I create more than one instance, either the application will exit without a word (in Debug Build), or only one of the works (Non Debug).
Should I post it in the Bug forum, or am I doing something silly?
' redrawgadget.bmx Strict Type TApplet Method OnEvent(Event:TEvent) Abstract Method New() AddHook EmitEventHook,eventhook,Self End Method Function eventhook:Object(id,data:Object,context:Object) Local event:TEvent Local app:TApplet event=TEvent(data) app=TApplet(context) app.OnEvent event End Function End Type Type TSpinningApplet Extends TApplet Field canvas:TGadget Field timer:TTimer Method Draw() SetGraphics CanvasGraphics(canvas) SetViewport 0,0,GraphicsWidth(),GraphicsHeight() SetBlend ALPHABLEND SetRotation MilliSecs()*.1 SetClsColor 255,0,0 Cls DrawRect GraphicsWidth()/2,GraphicsHeight()/2,128,128 Flip End Method Method OnEvent(Event:TEvent) Select event.id Case EVENT_WINDOWCLOSE End Case EVENT_TIMERTICK RedrawGadget canvas Case EVENT_GADGETPAINT draw End Select End Method Method Create:TSpinningApplet(Win:Tgadget) Local a:TApplet Local w,h w = ClientWidth(win) h=ClientHeight(win) canvas=CreateCanvas(0,0,w,h,win) canvas.SetLayout 1,1,1,1 timer=CreateTimer(90) Return Self End Method End Type Local spinner:TSpinningApplet Local Window:tgadget Local Spinner2:TSpinningApplet Local Window2:TGadget window=CreateWindow("Test1",20,20,512,512) spinner=New TSpinningApplet.Create(Window) window2=CreateWindow("Test2",20,20,512,512) spinner2=New TSpinningApplet.Create(Window2) While True WaitEvent Wend