Decision code
Pages: 1 2
Richard Ashbery (495) 163 posts |
My Drawing handler is as follows: DEF PROCDealWith_WindowRedraw(object,xo%,yo%) and to force a redraw I’ve added (using info. Chris’s posting).. SYS “Wimp_ForceRedraw”,object,minx,miny,maxx,maxyThe Drawfile displays correctly but then I get “illegal window handle”. The syntax looks OK – can anyone verify please? |
Fred Graute (114) 645 posts |
You’re passing the toolbox window object’s ID to Wimp_ForceRedraw but this needs to be the window object’s window handle. You can get the window handle by using Also, you don’t need to call PROCUtils_GetRedrawRectangle() as you’re redrawing the entire drawfile. The Wimp will sort out any clipping that needs to be done. |
Chris Hall (132) 3559 posts |
You need a loop to call ‘deal with window redraw’ presume you have something like:
|
Steve Fryatt (216) 2105 posts |
He won’t, because we’re discussing AppBASIC here. In the context of Richard’s example, PROCDealWith_WindowRedraw() is an AppBASIC event handler and so AppBASIC implements something like the following pseudo-code behind the scenes:
This makes most of your example unnecessary, as the event handler is called once for each redraw rectangle. There are also AppBASIC PROCs and FNs to do a lot of the standard window redraw calculations, by the look of it. |
Richard Ashbery (495) 163 posts |
Thanks Fred – I’m sure I’m nearly there. I’ve got the object’s window handle with… WimpHandle% = FNWindow_GetWimpHandle(object%) as you suggested. Using… SYS “Wimp_ForceRedraw”,WimpHandle%,536,144,1864,2120 where the four integers are minx,miny,maxx,maxy (obtained with MouseInfo) running the app. displays the Drawfile but – what I get is not easy to describe – the right-half of the window appears to give what looks like an animation – presumably caused by ForceRedraw SWI refreshing the window with the same image. Alt-Break is only means of stopping it. So that the app. knows what these values are, wouldn’t I still have to use… PROCUtils_GetRedrawRectangle() |
Fred Graute (114) 645 posts |
Using… SYS “Wimp_ForceRedraw”,WimpHandle%,536,144,1864,2120 What kind of coordinates does MouseInfo return? I assume it’s screen coordinates but as you’re passing a window handle to Wimp_ForceRedraw the coordinates should be relative to the window. To pass screen coordinates to Wimp_ForceRedraw you need to use -1 for the window handle. An easy way to find out which coordinates to supply is to add a button gadget that covers the area taken up by the drawfile. Then call Wimp_GetWindowState to find out where the window is, and PROCGadget_GetBBox to get the gadget’s bounding box. From that you can work out the screen area to pass to Wimp_ForceRedraw. Here’s the code that I use in ExifEdit to force a redraw of the displayed jpeg.
|
Richard Ashbery (495) 163 posts |
Thanks for your useful posting Fred. I haven’t had time to test your ForceRedraw code but I will get back to the Forum later in the week and let you know what happens. Incidentally MouseInfo displays mouse pointer info. in OS units. |
Pages: 1 2