How to find out the currently selected display?

Discuss any general programming issues here
Post Reply
Flinx
Posts: 377
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

How to find out the currently selected display?

Post by Flinx »

I'm searching for a way to determine which display is currently selected. Is this possible?
User avatar
jPV
Posts: 754
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: How to find out the currently selected display?

Post by jPV »

I guess you have searched the documentation pretty well, and I didn't see anything with a very quick look either.

Maybe something like this as a work-around:

Code: Select all

Function p_GetSelectedDisplay()
	Local type, id = GetAttribute(#DISPLAY, 0, #ATTROUTPUTDEVICE)
	If type = #DISPLAY Then Return(id) Else Return(-1)
EndFunction
It returns -1 is something else than a display is selected as the output device (brush, bgpic...), so in that case you must end the previous selection.
Flinx
Posts: 377
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: How to find out the currently selected display?

Post by Flinx »

Thanks! I hadn't found that. I'm not sure in which situations it fails this way, but at least it's better than nothing.
I had tried to make the table monitor I recently presented here as universally usable as possible, because it helped me quite a bit.
Since it requires a SelectDisplay, I have to switch back to the current display at the end of the interval function. I’ve now integrated your function; here’s the current version. I’ll keep experimenting a bit more.
Post Reply