Windows 7/8 versus windows 10

When you do a clean installation of Windows 7 or 8, you will have set the system-font-size set to medium (125%) by default. Because of this I set the height of a TextField-control to 25, which is 22 by default.
When you do a clean installation of Windows 10, or even an upgrade of the above mentioned Win7/8, you end up having the default system-fontsize set to 100%. This is ok to me, but I find my application not nice looking since my textfields should be set to height = 22 again.
To have this generic solved, I think about having a containercontrol holding a label and a textfield inside which resizes / reposition automatically.

Beside this, the proportions of objects is completely different in Windows 10 so you have to reposition thing to keep everything nice looking.

Curious how other Windows developers deal with this.

Good morning Joost,

well in enabling HiDPI

Soft Declare Function SetProcessDPIAware Lib "user32" () As Boolean

and using fixed sizes and letting some extra space left so that at least 100% and 125% both work fine. Everything beyond this? Well I do not have any customer using 150%… and I hope I won’t get one :wink:

And until Xojo does not support HiDPI through the framework (e.g. in toolbars) you have to switch to 3rd Party components.

Here are some Screenies:

100%

125%

150%

I’m afraid 200% is very common on laptops with 4K screens

Oh dear… I hope Xojo will be faster than the market penetration of 4K laptops :wink:

RubberViews manages scaled display as well.

of course, that’s correct that’s why I mentioned “3rd party components” :wink:
and this is the reason why I’ve bought your uncrypted license… I am following the strict policy not to use anything uncrypted in my software (esp. in software for my key “bread-and-butter” customers)

Seems I have the uncrypted Rubberviews license twice (to keep Michel happy) and will try to implement it in a Windows project later. Features first … to keep my “bread-and-butter” customer happy too.

@Tomas Jakobs - thanks for the DPI-aware tip.

Problem solved.

one last thing Joost… if you’re using any canvas in your HiDPI’ed Apps, dont forget to check scaling factor … this snipped is valid for Windows only, you have to try… catch and set pragmas if used multiplatform.

function ScalingFactor as Single

    Try
      
      Soft Declare Function GetDC Lib "user32" (hWnd As Ptr) As Ptr
      Soft Declare Function GetDeviceCaps Lib "gdi32" (hdc As Ptr, nIndex As Integer) As Integer
      Soft Declare Sub ReleaseDC Lib "user32" (hWnd As Ptr, hdc As Ptr)
      
      Const LOGPIXELSX = 88
      Const LOGPIXELSY = 90
      
      Dim hdc As Ptr = GetDC(Nil)
      Dim dpiX As Integer = GetDeviceCaps(hdc, LOGPIXELSX)
      Dim dpiY As Integer = GetDeviceCaps(hdc, LOGPIXELSY)
      ReleaseDC(Nil, hdc)
      
      Dim scaleFactorX As Double = dpiX / 96
      Dim scaleFactorY As Double = dpiY / 96
      
      Return scaleFactorX
      
    Catch
      
      Return 1
      
    Finally
      
    end Try
    
end function

and this should stay in the .Paint Event of your canvas

  If ScalingFactor > 1 Then
     g.DrawPicture(HiresImage, 0, 0, g.Width, g.Height, 0, 0, HiresImage.Width, HiresImage.Height)
  Else
     g.DrawPicture(NormalImage, 0, 0)
  End If

and of course this should be revalidated/ rechecked if the window is moved in multi-display enviroments (PC with one HiDPI display, one 2nd non-HiDPI display)

Thanks a lot Tomas.
I do use CANVAS in my application many times and was just looking for this.
This should has been a part of the framework for RAD shouldn’t it ?

http://blog.xojo.com/o-retina-retina-wherefore-art-thou-retina

…you owe me a beer in Koblenz Joost :wink: Are you coming?

Of course I will be comming !

Aaaa I am getting thirsty now :wink:

". . . . this feature along with a Retina/HiDPI-enabled Xojo IDE will come in 2016r1. " Thank you !

Since you’re both on the Beta I’m surprised you were NOT aware of this blog post - we did post this on the beta list

See you in Koblenz
Beer sounds good

Pssst Norm, I just wanted to grab my free beer :wink:
I was aware of this blog post but you know… it’s ready when it’s finished… :wink:

Huh - free beer
I like it !

As I understand it, HiDPI support

  • does one thing in Windows 7
  • was changed in Windows 8
  • was changed again in Windows 8.1
  • was finally done “right” in Windows 10 (which means, about as good as Mac OS was 4 years ago)

So if you are writing apps, there is a serious motivation to just support Windows 10 and be done with it. Other options lead to madness.

I trust Xojo to support correctly Windows 10.

Microsoft itself is stopping support for Windows 7 SP1 http://www.zdnet.com/article/windows-7-support-what-happens-on-january-13-2015/ so I would not find it shocking to support only Win 10.