Open timmerk opened 2 years ago
Can you post the crash log? I'm not able to reproduce this with 2022r1.1.
I should have mentioned I was using the ZirconSwitch control with ArtisanKit. It doesn't crash per say, but gives a Nil exception at that line. I discovered it's because I placed a ZirconSwitch control on a DesktopWindow, not a Window. While the ZirconSwitch demo app works fine, I was able to replicate the bug by changing the main window in the demo app to a DesktopWindow.
Yeah Xojo has some issues with mixing old and new controls together. For control developers, they haven't really given us a way to support both. One way or another, somebody is getting disappointed.
Ah, I see. I'm just starting Xojo, so still getting used to things! For now I made this change, which I believe won't work if the control is inside a container:
Highlighted = IsKeyWindow(Self.Window.Handle) Or IsMainWindow(Self.Window.Handle)
But it's good enough for now. :) Thanks for providing this control!
I had the same issue today for ZirconBreadcrumbs, I just modified the code of ArtisanKit
And finally for the issue in the Paint event
Declare Function IsMainWindow Lib "Cocoa.framework" Selector "isMainWindow" (Target As Ptr) As Boolean Declare Function IsKeyWindow Lib "Cocoa.framework" Selector "isKeyWindow" (Target As Ptr) As Boolean Highlighted = IsKeyWindow(Self.Window.Handle) Or IsMainWindow(Self.Window.Handle)
Just the default color that are a bit messed up but setting them fix the issues
This line in the Control class crashes Xojo 2022r1:
Highlighted = IsKeyWindow(Self.TrueWindow.Handle) Or IsMainWindow(Self.TrueWindow.Handle)
It seems TrueWindow doesn't exist anymore, or doesn't work. It's listed in the docs for the old RectControl, but not in DesktopUIControl, but maybe they accidentally broke it in RectControl.