Resizing Window, Showing/Hiding Controls and Flicker in Windows

I am programmatically resizing a window and showing a rectangle and controls within it and you’ll see there’s some annoying flicker. I know there have been some discussions about this in the past, but I haven’t seen anything on this topic lately so I thought it might make sense to ask this question post 2019 R3.

Here’s my basic code in the “Dymo” button that makes the window larger and shows additional content.

// Toggle Dymo section on and off
Self.Height = If(Self.Height = 975,800,975)
Self.rectMainButtons.Top = If(Self.Height = 975,877,700)
sepDymo.Visible = Self.Height = 975
rectDymo1.Visible = Self.Height = 975
rectDymo2.Visible = Self.Height = 975

See link to my 7 second video which reveals this behaviour. Any suggestions? Thank you!

Flicker in Windows App

This should be an easy fix. I’m collecting examples of these for a future release of a tutorial on these kinds of issues and I’d be interested to see whats causing the slow down so would you be able to knock up a little demo app of this happening and I’ll fix it for you.

First, don’t use Rectangles but ContainerControls instead.
Second in the containercontrol go to the inspector (right) click on the small gear icon and selecte DoubleBuffer = True (only applies to windows).
Now you should NOT have any flicker.

@JulianS Thank you for offering your help on this! Derk’s solution seems to be working for me although I’d prefer not to use container controls in this case only because I have to go through extra steps to edit the controls contained within it. I guess that I just don’t understand why there are issues at all with flicker in Xojo for Windows…this does not require a lot of processing power…showing/hiding a handful of controls.

@Derk Jochems I put the controls (text boxes, popup menus, etc) in a container and the flicker has been eliminated. You said to turn on double buffering which seems fine to me but what about this new “ContainerControl.Composite” option that we have? There are no code samples for this new setting that came with API 2.0.

Thank you!