I think I have a good solution now.
- I changed the resize code so that if you bind a callback to the #PB_EventType_Resize event for the CanvasGadget, you get a chance to update the content before the resized content is drawn to the screen. This way there is no flicker, even if you draw stuff into the resized area.
- I also added SetGadgetColor() support as well, so can define the color for the resized area
So the example from above will have to look like this for a flicker-free resize:
Code:
Procedure ResizeOne()
If StartDrawing (CanvasOutput (1))
Box(0, 0, GadgetWidth (1), GadgetHeight (1), #Red)
StopDrawing()
EndIf
EndProcedure
Procedure ResizeTwo()
If StartDrawing (CanvasOutput (2))
Box(0, 0, GadgetWidth (2), GadgetHeight (2), #Green)
StopDrawing()
EndIf
EndProcedure
OpenWindow (0, 0, 0, 1280, 1024, "SplitterGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget (1, 0, 0, 0, 0)
CanvasGadget (2, 0, 0, 0, 0)
SplitterGadget (0, 1, 1, 1278, 1022, 1, 2)
ResizeOne()
ResizeTwo()
BindGadgetEvent(1, @ResizeOne(), #PB_EventType_Resize)
BindGadgetEvent(2, @ResizeTwo(), #PB_EventType_Resize)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
All this will be in PB 5.70.