Page 1 of 1
How to find out the currently selected display?
Posted: Tue Jun 02, 2026 4:40 pm
by Flinx
I'm searching for a way to determine which display is currently selected. Is this possible?
Re: How to find out the currently selected display?
Posted: Thu Jun 04, 2026 12:02 pm
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.
Re: How to find out the currently selected display?
Posted: Fri Jun 05, 2026 4:49 pm
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.
Re: How to find out the currently selected display?
Posted: Sun Jun 07, 2026 3:32 pm
by airsoftsoftwair
jPV wrote: ↑Thu Jun 04, 2026 12:02 pm
Maybe something like this as a work-around:
I'd say that's not the work-around but the official solution

Of course I could add a real function like GetOutputDevice() or something but I think that would do exactly the same as your GetAttribute(#DISPLAY, 0, #ATTROUTPUTDEVICE) or are there any cases where that doesn't do what it should? I think it should be a perfectly safe solution.
Re: How to find out the currently selected display?
Posted: Mon Jun 08, 2026 11:05 am
by Flinx
Now that I’ve taken a closer look, I realize my question was too specific. I had imagined it too simple. “Change the output device within an interval function and restore the previous state at the end of that function” is much more complicated than I had expected at the time. Okay, I should have guessed that, since I’ve already used different output devices before, but at that moment I was just focused on the display.
Let’s see if I can find a solution for this, but maybe it’s not even possible with the available commands, since the various Select variants have a lot of parameters as well.
Or does anyone see a quick and easy solution?

Re: How to find out the currently selected display?
Posted: Thu Jun 11, 2026 8:43 am
by jPV
I think it's the safest to end a previous selection before it returns to the main loop if it's something else than a display...