PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Accommodate different monitor sizes  (Read 1541 times)

Peter.Higgins

  • Diamond Member
  • *****
  • Posts: 124
    • View Profile
Accommodate different monitor sizes
« on: May 23, 2019, 04:33:51 PM »
Trying to make  panels relatively the same size on different monitors.

After obtaining the monitor DPI and calculating the new default graphic and text fonts
it looks like I need to drop and reinstantiate or init() the *obj/nomads.pvc object.
That's where nomads instantiation gets murky.

Does the font have any affect on character size?
Will I also have to set other fields like the Xchar, YChar, Xmax, Ymax? 


James Zukowski

  • Diamond Member
  • *****
  • Posts: 297
    • View Profile
Re: Accommodate different monitor sizes
« Reply #1 on: May 23, 2019, 05:16:22 PM »
There's an easier way, as we are doing something that requires the same sort of recalculation of the font size world.

Use the 'option'() mnemonic to change the "StdFont" for the current PC. You may also need to change the 'font'() and set new values for your 'GF' and/or 'DF'.

Some Nomads variables to check are:
  • 'Pnl_Def_Font$
  • 'Override_Font$
  • 'XChar and %Nomad_XChar
To prevent too much flickering, you may want to position the current window WAY off the screen with 'option'("XYPos",...), do the changes, and then reposition it back to where you want it.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Peter.Higgins

  • Diamond Member
  • *****
  • Posts: 124
    • View Profile
Re: Accommodate different monitor sizes
« Reply #2 on: May 24, 2019, 08:26:20 AM »
THANKS James,

Great tip!  We are already doing some of this. 
The old code was using the same fonts, just reading  'OPTION'("Stdfont") to refactor the size, so I was thinking of adding "GraphicFont" as well thinking it was needed for the graphic fonted text labels. 

Now  hopefully someone will be able to point out where DPI value is available in the system. 

James Zukowski

  • Diamond Member
  • *****
  • Posts: 297
    • View Profile
Re: Accommodate different monitor sizes
« Reply #3 on: May 24, 2019, 10:24:31 AM »
That would be in fin(0,"XYMonitors").

James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services