I currently use the following code (I think pulled from Xojo’s blog) for determining if a Window is running on a Retina (HiDPI) display:
Function ScalingFactor(win As Window) As Single
#if TargetCocoa then
declare function BackingScaleFactor lib "AppKit" selector "backingScaleFactor" (target as WindowPtr) _
as double
return BackingScaleFactor(win)
#else
return 1
#endif
End Function
If it returns > 1 it’s HiDPI. Obviously though this only returns 1 for both Windows & Linux. Does anyone know of a way (declare??) to determine if a Xojo Window is running on a HiDPI display on Windows (& Linux if possible)?
There is also an article in xDev Magazine:
Issue 10.6 (September/October 2012):
Working With Retina: Making your Real Studio applications high resolution (Page 25)
This code is enclosed in a #If TargetCocoa: it will works only on OS X.
No, I do not know. Did you check in Windows Functionality Suite ?[/quote]
Yep, I understand the conditional. I took a look at WFS, I don’t see any methods that help though.
Well I have another issue with HiDPI on Windows and Toolbars:
Retina support on Mac works pretty good for me and I am replacing all images with x2 images there. But on Windows this doesn’t seem to work. The replaced graphics in the Toolbar are more worse than the regular ones:
Here are 2 Screenshots, the 1st one with 2x Images for toolbar:
own naming convention (external32 and external32x2), In an IF clause I am checking Scalefactor (sf) and if HiDPI I swap them:
[code] // Alle Pushbuttons Resetten
For i = 0 to TOOLBAR_Main1.Count
If TOOLBAR_Main1.Item(i) IsA ToolButton then
t = TOOLBAR_Main1.Item(i)
if ToolButton(t).Name = "tbNewLease" then
ToolButton(t).Enabled = (NumberOfAvailableKeys > 0) and (NumberOfContacts > 0)
ToolButton(t).Icon = if(sf > 1, external32x2, external32)
end if