Problem to get screen resolution

Find quick help here to get you started with Hollywood
Post Reply
papiosaur
Posts: 217
Joined: Fri Mar 31, 2023 1:34 pm

Problem to get screen resolution

Post 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?
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Problem to get screen resolution

Post 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)
papiosaur
Posts: 217
Joined: Fri Mar 31, 2023 1:34 pm

Re: Problem to get screen resolution

Post by papiosaur »

Thanks a lot Flinx, it's works!

I get Height, Width and Depth ;-)
User avatar
jPV
Posts: 734
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Problem to get screen resolution

Post 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 :)
papiosaur
Posts: 217
Joined: Fri Mar 31, 2023 1:34 pm

Re: Problem to get screen resolution

Post by papiosaur »

Thanks a lot jPV for the tips, it will be usefull i think ;-)
Post Reply