Impact of Video Settings

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
omni
Posts: 547
Joined: Thu Jan 28, 2010 9:34 am

Impact of Video Settings

#1 Post by omni »

Roger,

More and more users are adjusting their desktops to 1.25%. Also, some monitors, especially on windows 10, autoadjust to make text larger. Mine, for instance locks in at 175% and I cannot change it. But the font that is set up is very small if not adjusted to make the screens high graphics.

The impact is ugly. For both 1.9 and 2.0 the windows are perfect when opened at normal font. As the text size is modified by windows set up, the gets on rows are on top of the next @dcsay, if one exists that is close. (ie, like a city/state/zip line with descriptions).
Any thoughts on how to handle this? 1.9 and 2.0 display slightly differently on this issue but both have the same basic problem.

Thanks

Fred
omni

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Impact of Video Settings

#2 Post by Cliff Wiernik »

I also have the problem when users do that. I have implemented my screen sizing using the method in xdemo where based on screen size, it sets some of the various parameters.

I am looking to the best way to address this. I don' t really know that I want the full autoresizing as in limited testing it has not worked completely and I would likely need to make some other changes. I have looked at the scale font samples, but want to know how to make the change from the xdemo approach to using scalefonts if that is the best way.

I know that in principle, if they set the fonts to 125%, then the application has to either undo the standard spacing to compensate for the change otherwise, gets don't fit within the box and says are too big.

But what is the best approach from the current starting point.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: Impact of Video Settings

#3 Post by bwolfsohn »

checking for 96dpi..

function issmallfonts(lDisplay)
*********************
// Pixels per inch if small or large font is active
#define SMALLFONT 96
#define LARGEFONT 120
// DeviceCap ID to retrieve device pix/inch attribute
#define LOGPIXELSX 88
#define LOGPIXELSY 90

LOCAL oDesktop := AppDesktop()
LOCAL hWND
LOCAL hDC
LOCAL nLogPix,cMsg
default lDisplay:=.f.
IF(ValType(oDesktop)!="O" .AND. !oDesktop:IsDerivedFrom("XbpIWindow"))
// Non GUI mode
RETURN(NIL)
ENDIF
hWND := oDesktop:GetHWND()
hDC := GetDC(hWND)
IF(hDC==-1)
// could not aquire device
RETURN(NIL)
ENDIF
nLogPix := GetDeviceCaps(hDC,LOGPIXELSX)
ReleaseDC(hWND,hDC)
IF lDisplay
cMsg:="Font Size is "+dc_xtoc(nLogPix)+" DPI"
cMsg+=". 96 DPI is the only DPI setting compatible with CUS Software"
dc_msgbox(cMsg)
ENDIF

RETURN(nLogPix== SMALLFONT)

DLLFUNCTION GetDC( nHWND ) USING STDCALL FROM USER32.DLL
DLLFUNCTION ReleaseDC( nHWND, nHDC ) USING STDCALL FROM USER32.DLL
DLLFUNCTION GetDeviceCaps( nHWND, nIndex ) USING STDCALL FROM GDI32.DLL
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
Auge_Ohr
Posts: 1422
Joined: Wed Feb 24, 2010 3:44 pm

Re: Impact of Video Settings

#4 Post by Auge_Ohr »

bwolfsohn wrote:checking for 96dpi..
on Windows 7/8x/10 > 125% you will always get 96DPI for a "virtual" Desktop ( 125% is native )
! Note : when use a "virtual" Desktop Xbase++ AppDeskTop():CurrentSize() return "virtual" Size not real native Size .

API Function GetDeviceCaps is right but IMHO you need other Constant ( see Sample )
DESKSIZE.ZIP
use ot4xb Syntax
(816 Bytes) Downloaded 895 times
since v1.9x we have "undocumented" Function LayoutManager (in xppui3.lib) which now in v2.x appear in Help File.
LayoutManager.ZIP
Sample for Xbase++ v.1.9x/v2.x
(7.84 KiB) Downloaded 923 times
you don´t need any "resize" or "zoom" when User maximize ... let Xbase++ calculate Position / Size of a XbPart :!:
! Note : LayoutManager does not change Font Size ...

begin with Vista / Windows 7 you can write "more" Segment into your XP Manifest. when using

Code: Select all

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
       <windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
           <dpiAware>true</dpiAware>
       </windowsSettings>
  </application>
you can make your Xbase++ Application "DPI-aware".
if you use "DPI-aware" and LayoutManager you do not have to think about "any Size" :lol:
greetings by OHR
Jimmy

omni
Posts: 547
Joined: Thu Jan 28, 2010 9:34 am

Re: Impact of Video Settings

#5 Post by omni »

A little over my head. Where would you put this desktop.prg in an application.


Fred

User avatar
rdonnay
Site Admin
Posts: 4775
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Impact of Video Settings

#6 Post by rdonnay »

You can test for the DPI setting at the start of your program and then set your basefont accordingly.
Try the below code. I haven't tested it.

Code: Select all

o := AppDesktop()
h := getDc(o:getHwnd())
nDPI := GetDeviceCaps(h,90)

IF nDPI == 96
  DC_BaseFont('8.Helv')
ELSE
  DC_BaseFont('7.Helv')
ENDIF
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1422
Joined: Wed Feb 24, 2010 3:44 pm

Re: Impact of Video Settings

#7 Post by Auge_Ohr »

rdonnay wrote:You can test for the DPI setting at the start of your program and then set your basefont accordingly.
Try the below code. I haven't tested it.

Code: Select all

nDPI := GetDeviceCaps(h,90)
you are working with

Code: Select all

#define LOGPIXELSY 90
which give you "virtual" Size. this will always give you 96 !

lets say real native Size is 1920 x 1280. now adjust to 200 % and check AppDeskTop():Currentsize() which will show <> 1920 x 1280
now try

Code: Select all

#define DESKTOPVERTRES 117 
#define DESKTOPHORZRES 118
and you will see what i mean that the "old" Code only work on "native" Resolution of "old" Windows OS().
greetings by OHR
Jimmy

Post Reply