Redrawing during window move/size?
BlitzMax Forums/BlitzMax Programming/Redrawing during window move/size?
| ||
It would be nice to be able to do stuff while a window is being resized or moved, so that I can re-draw viewports while they are being sized. Is this possible? |
| ||
Yes, see the RedrawGadget example and if you haven't done so please read Help->Tutorials->MaxGUIOverview. |
| ||
Is it possible to make panel gadgets detect a GADGET_PAINT event? |
| ||
I had to do this in something I was making. Event Hooks have to be used. Here's a little example: |
| ||
Nice! It works perfectly with an OpenGL viewport created on a panel. What if the viewport gets corrupted by dragging something over it? Panels don't produce gadgetpaint events. Detecting a WindowMove event won't work for this. In PureBasic, I had to do something like this: Procedure SubclassProc(hWnd,Mesg,wParam,lParam) If mesg=#WM_PAINT ;Repaint the window EndIf AddMessage(mess,hWnd,wParam,lParam) ProcedureReturn CallWindowProc_(oldProc,hWnd,Mesg,wParam,lParam) EndProcedure |
| ||
If I understood your problem right you could do it this way: To get the file requester just click on the canvas. I just added a Sus variable and also set the if statement in the hook function to run if Sus = True. If you set Sus to true before you open the requestor and set it to false afterwards it works. There might be a better way but this seems to work fine for me. |
| ||
Use a Canvas not a Panel. |
| ||
I'll try a canvas. In BlitzPlus, canvases were not good for OpenGL viewports. I also found the solution for panels. This is really nice because I don't have to have a bunch of extra render calls in every waitevent() loop: Extern "Win32" Function SetWindowLong(hwnd:Int,index:Int,newlong:Int) = "SetWindowLongA@12" Function CallWindowProc:Int(prevwndfunc:Int,hwnd:Int,msg:Int,wparam:Byte Ptr,lparam:Byte Ptr) = "CallWindowProcA@20" EndExtern Const GWL_WNDPROC=-4 Const WM_PAINT=15 hwnd=QueryGadget(Viewport.panel,QUERY_HWND) Global OldWindowCallback=SetWindowLong(hwnd,GWL_WNDPROC,Int(Byte Ptr(WindowCallback))) Function WindowCallback(hwnd,msg,wparam:Byte Ptr,lparam:Byte Ptr) "win32" Select msg Case WM_PAINT renderworld sync EndSelect Return CallWindowProc(OldWindowCallback,hwnd,msg,wparam,lparam) End Function |
| ||
Well, BlitzMax canvases don't seem to have the problems BlitzPlus canvases did, so it looks like they are fine for OpenGL viewports. Thanks for the tips. This is the greatest programming language ever. |