Windows Darkmode flickers white when embedding container controls
I tried everything that I could think of but it always flickers white briefly as I switch between them. Which of course is horrible to see the white flashes when your in dark mode.
Bellow is example of the case just about.
Does anyone know of good way to eliminate this flicker ?
Public Sub SwitchViews(newView as IContextPanel)
Using EinhugurMacOSBridge
if CurrentPanel <> nil then
CurrentPanel.Close()
end if
CurrentPanel = newView
BlockRedraw(ContainerControl(newView))
newView.EmbedPanel(self,180,160,541,430)
//newView.Refresh()
AllowRedraw(ContainerControl(newView))
newView.LoadData(WeakAddressOf UIStateNotify)
#If TargetMacOS
mTouchBarReceipt = NSTouchBar.RegisterForWindow(Self, AddressOf CreateTouchBar)
#EndIf
// If mDecryptButton <> Nil Then
// UIStateNotify
// end if
End Sub
But I really think there is bug there in Xojo, that it flickers white in Darkmode when you close container control.
The fix bellow works because I embed new control first over the area where the old was, then close the old instead of closing first and embedding later.
Using EinhugurMacOSBridge
var oldPanel as IContextPanel
if CurrentPanel <> nil then
oldPanel = CurrentPanel
end if
CurrentPanel = newView
newView.EmbedPanel(self,180,160,541,430)
newView.Refresh()
newView.LoadData(WeakAddressOf UIStateNotify)
#If TargetMacOS
mTouchBarReceipt = NSTouchBar.RegisterForWindow(Self, AddressOf CreateTouchBar)
#EndIf
if oldPanel <> nil then
// Close the old view after the new View has covered the area to prevent Xojo to do ugly
// white flicker in the area which was covered by the old container.
oldPanel.Close()
end if
I got it quite nice after a days work, and once I realized the flicker was caused by ContainerControl.Close, then its quite nice and no flicker anywhere in the App.