This is something I’ve never seen before. Is it perhaps a bug in Xojo 2021r3? Not sure but let me explain/
First of all, I am seeing this on Mac OS. I have a listbox which contains a number of pop-up menus positioned in one of the columns. I have a method that sets the size of the list box to the NSSmall size that someone here provided:
Public Sub setControlSize(Extends c as RectControl, inSize as NSControlSize)
#If TargetCocoa Then
Declare Function NSClassFromString Lib "Cocoa" (className As CFStringRef) As Ptr
declare sub setSize lib "Cocoa" selector "setControlSize:" _
( ObjectHandle as Integer, inSize as NSControlSize )
Declare function getCell lib "Cocoa" selector "cell" ( handle as integer ) as Integer
if c isa progressBar or c isa ProgressWheel then
setSize( c.handle, inSize )
else
setSize( getCell( c.handle ), inSize )
// - Now we also update the text font to match
Dim fontSize as Double
select case inSize
case NSControlSize.NSRegularControlSize
declare function systemFontSize lib "Cocoa" selector "systemFontSize" _
( classRef as Ptr ) as Double
fontSize = systemFontSize( NSClassFromString( "NSFont" ) )
else
// + (CGFloat)smallSystemFontSize
declare function smallSystemFontSize lib "Cocoa" selector "smallSystemFontSize" _
( classRef as Ptr ) as Double
fontSize = smallSystemFontSize( NSClassFromString( "NSFont" ) )
end select
// + (NSFont *)systemFontOfSize:(CGFloat)fontSize
declare function systemFontOfSize lib "Cocoa" selector "systemFontOfSize:" _
( classRef as Ptr, inSize as Double ) as Ptr
Dim ref as Ptr = systemFontOfSize( NSClassFromString( "NSFont" ), fontSize )
if ref <> nil then
// - (void)setFont:(NSFont *)fontObject
declare sub setFont lib "Cocoa" selector "setFont:" _
( NSControlHandle as integer, font as Ptr )
setFont( c.handle, ref )
end if
end if
#else
#pragma undefined
#endif
End Sub
When I run in debug mode - things are fine. When I compile using default optimization, my pop-up menus look correct like this:
But when I compile with Aggressive optimization, I get this:
I have NEVER seen this before. I always use the Aggressive optimization setting when compiling my releases. I probably don’t need to and at this point, I’m not going to. But I think this might be a bug in 2021r3 as nothing in these have changed from previously.
Thoughts anyone?
Jon