Page 1 of 1

Problem to get screen resolution

Posted: Wed Aug 14, 2024 11:48 am
by papiosaur
Hello,

i try to get screen resolution (on MorphOS) and i use this code:

Code: Select all

t, info = GetPubScreens()
For Local k = 0 To ListItems(info) - 1 Do DebugPrint(info[k])
For Local k = 0 To ListItems(t) - 1 Do DebugPrint(t[k])
Unfortunally, i obtain only these informations:
Workbench
Table: 0x25cdb918
Any ideas please?

Re: Problem to get screen resolution

Posted: Wed Aug 14, 2024 1:17 pm
by Flinx
I don't have an Amiga here at the moment, so I can't try, but the manual says "one subtable for each public screen". Based on the manual, I would have expected the word “Workbench” in the table t, not in info. I'm guessing that the quoted output doesn't come from exactly this code example.
Try

Code: Select all

DebugPrint(info[0].Width)
If you have a table you do not know, you can always look with ForEach:

Code: Select all

For Local k = 0 To ListItems(info) - 1 Do ForEach(info[k], DebugPrint)

Re: Problem to get screen resolution

Posted: Wed Aug 14, 2024 2:17 pm
by papiosaur
Thanks a lot Flinx, it's works!

I get Height, Width and Depth ;-)

Re: Problem to get screen resolution

Posted: Wed Aug 14, 2024 3:25 pm
by jPV
And if you just want to get resolution of the screen your program is running on, you can use GetAttribute(#DISPLAY, 1, #ATTRHOSTWIDTH) etc. Then you don't have to guess which screen info you want when you have multiple screens open :)

Re: Problem to get screen resolution

Posted: Wed Aug 14, 2024 7:09 pm
by papiosaur
Thanks a lot jPV for the tips, it will be usefull i think ;-)