internal error and refreshing problem
BlitzPlus Forums/BlitzPlus Programming/internal error and refreshing problem
| ||
triyng to execute the following code, after window closing - in debug mode - I obtain this warning message: "attempt to release <unknown> object" the code opens a window with a canvas, and repeatedly grabs canvas to an image drawing something on it at each cycle; but the changes only take place when mouse is moved over the canvas area (not simply positioned 'over' canvas, but 'moving' on it). This code acts as a model for a more complex piece of software, but I can't figure out the warning message, nor the canvas refreshing behavior. Some ideas? ; ==================== ; === here is the code win=CreateWindow("win",200,200,300,300,0) x=ClientWidth(win) y=ClientHeight(win) can=CreateCanvas(10,10,200,200,win) img=CreateImage(200,200) Repeat SetBuffer CanvasBuffer(can) Cls DrawImage img,0,0 Color Rnd(256),Rnd(256),Rnd(256) Rect 10,10,100,100 SetBuffer ImageBuffer(img) GrabImage img,0,0 FlipCanvas(can) e=WaitEvent() Select e Case $803 End End Select Forever ; === end of code |
| ||
before the 'End' command, add this:Setbuffer Desktopbuffer() see if it helps.. |
| ||
thank you CS_TBL, no more warning message I still can't understand why the canvas does not refresh |
| ||
I dunno what your intentions are with this app.. you want the rect to flicker all the time, as in: always update? This app waits for incoming events.. if nothing happens, nothing happens. |
| ||
Hi, change e=WaitEvent() to e=WaitEvent(5). See, what's happening is that WaitEvent() waits forever for an event. Moving the mouse over the canvas causes a $203 event - and so your program proceeds. Clicking the mouse will also move the program along as that also causes an event. WaitEvent(5) waits 5 milliseconds for an event and then proceeds regardless of whether an event happened or not. You can change 5 to whataver you want. |
| ||
I wonder what eventually is better.. WaitEvent(time) or a $4001-timer with a normal WaitEvent().. |
| ||
Ok, thank you my intention with this app: it is only a model for a more complex software; I need a great deal of lines and other graphic elements to be drawn at each canvas refreshing cycle, and the number of them is increasing in time; so I am looking for a way to avoid continuous redrawing of graphics: I thougth to obtain this by: 1 showing an image 2 drawing some graphics on it 3 grabbing image with added graphics 4 showing the changed image and so on maybe this is not the fastes method ... |