I can easily get the size of a dialog, but have not yet identified how to get the corresponding size of the display itself.
Does anyone know how to get the display size (preferably in pixels) and what is the maximum safe size for the design of a dialog screen.
* Getting Display Resolution
Getting Display Resolution
Norman Martin
- ColeValleyGirl
- Megastar
- Posts: 5643
- Joined: 28 Dec 2005 22:02
- Family Historian: V7
- Location: Cirencester, Gloucestershire
- Contact:
Re: Getting Display Resolution
Why not let IUP do the work? From the Attributes for a Dialog:
SIZE (non inheritable): Dialog’s size. Additionally the following values can also be defined for width and/or height:
"FULL": Defines the dialog’s width (or height) equal to the screen's width (or height)
"HALF": Defines the dialog’s width (or height) equal to half the screen's width (or height)
"THIRD": Defines the dialog’s width (or height) equal to 1/3 the screen's width (or height)
"QUARTER": Defines the dialog’s width (or height) equal to 1/4 of the screen's width (or height)
"EIGHTH": Defines the dialog’s width (or height) equal to 1/8 of the screen's width (or height)
Helen Wright
ColeValleyGirl's family history
ColeValleyGirl's family history
Re: Getting Display Resolution
I thought of that, but it seems that you have to set the dialog to 'FULLxFULL' and then apply that setting to get the screen resolution.
I then have to reset the dialog size to a smaller value, if that is all I need. That gives a flickering dialog form.
However, it does work. I thought there might be a way to avoid sizing the dialog to full screen to see if the native size of the dialog will display safely on the screen.
Sort of hoping there may be either a Display.Size attribute in IUP or something in fhutils.
I then have to reset the dialog size to a smaller value, if that is all I need. That gives a flickering dialog form.
However, it does work. I thought there might be a way to avoid sizing the dialog to full screen to see if the native size of the dialog will display safely on the screen.
Sort of hoping there may be either a Display.Size attribute in IUP or something in fhutils.
Norman Martin
- ColeValleyGirl
- Megastar
- Posts: 5643
- Joined: 28 Dec 2005 22:02
- Family Historian: V7
- Location: Cirencester, Gloucestershire
- Contact:
Re: Getting Display Resolution
I usually set the size of a Dialog to HALF x HALF, knowing that will fit on the screen, and have scrollbars where needed, plus the ability to resize the dialog.
However, if you look in the IUP documentation and Attributes > Global > Screen information, you'll find (if you haven't already found it)
However, if you look in the IUP documentation and Attributes > Global > Screen information, you'll find (if you haven't already found it)
FULLSIZE (read-only)
Returns the full screen size in pixels.
String in the "widthxheight" format.
SCREENSIZE (read-only)
Returns the screen size in pixels available for dialogs, i.e. not including menu bars, task bars, etc. In Motif has the same value as the FULLSIZE attribute. The main screen size does not include additional monitors.
String in the "widthxheight" format.
Helen Wright
ColeValleyGirl's family history
ColeValleyGirl's family history
- Mark1834
- Megastar
- Posts: 2644
- Joined: 27 Oct 2017 19:33
- Family Historian: V7
- Location: South Cheshire, UK
Re: Getting Display Resolution
Can’t remember the exact syntax as I’m away from the computer, but dialog:map() places all the elements in the form without actually drawing it. Does that help?
Mark Draper
Re: Getting Display Resolution
Thanks
Getting the SCREENSIZE attribute finds the information perfectly. I can do that when the plugin first starts so that I can adjust the dialog to be displayed at the appropriate size (or to say that the resolution is too low to support the dialog).
The information had to be somewhere, I just could not find it.
Getting the SCREENSIZE attribute finds the information perfectly. I can do that when the plugin first starts so that I can adjust the dialog to be displayed at the appropriate size (or to say that the resolution is too low to support the dialog).
The information had to be somewhere, I just could not find it.
Norman Martin
- ColeValleyGirl
- Megastar
- Posts: 5643
- Joined: 28 Dec 2005 22:02
- Family Historian: V7
- Location: Cirencester, Gloucestershire
- Contact:
Re: Getting Display Resolution
Says everyone who has ever used IUP...
I am increasingly resorting to ChatGPT:
In Lua, using the IUP library, you can get the size of the display in pixels by utilizing the iup.GetScreenSize() function. Here's how you can do it:
lua
This script simply retrieves the screen size using the iup.GetScreenSize() function and then prints out the width and height in pixels.Code: Select all
require("iuplua") -- Get the screen size local width, height = iup.GetScreenSize() -- Print the screen size in pixels print("Screen width:", width, "height:", height)
Helen Wright
ColeValleyGirl's family history
ColeValleyGirl's family history
Re: Getting Display Resolution
Thanks to your help, I have managed to write a function to automatically resize a dialog to be within the size of the screen.
A little more challenging than I had hoped (and careful reading of the IUP documentation) , but with using a scrollbox in the dialog have managed to scale a reasonable size dialog into a 800 by 600 display.
Thanks a lot
Norman
A little more challenging than I had hoped (and careful reading of the IUP documentation) , but with using a scrollbox in the dialog have managed to scale a reasonable size dialog into a 800 by 600 display.
Thanks a lot
Norman
Norman Martin