thommcgrath / ArtisanKit

Previously ZirconKit, Artisan Kit is a set of classes designed to make custom control creation easier.
MIT License
4 stars 0 forks source link

Crash in 2022r1 #1

Open timmerk opened 2 years ago

timmerk commented 2 years ago

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.

thommcgrath commented 2 years ago

Can you post the crash log? I'm not able to reproduce this with 2022r1.1.

timmerk commented 2 years ago

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.

thommcgrath commented 2 years ago

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.

timmerk commented 2 years ago

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!

Kumzy commented 5 months ago

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