Drawing to multiple monitors

BlitzMax Forums/BlitzMax Programming/Drawing to multiple monitors

BugZilla(Posted 2009) [#1]
I am thinking of building a teleprompter application. I need to know how to draw specific items on multiple monitors. For example, monitor 1 would show the prompter text, monitor 2 would show the same text only drawn in reverse (so it will look correct in the mirror that is mounted on the camera.

How can one detect and send drawing commands to specific monitors for a computer that has two monitors attached?


jsp(Posted 2009) [#2]
When using MaxGui you can detect the size of the first primary monitor with ClientWidth(Desktop()) or ClientHeight(Desktop()) and the complete size (primary and secondary display) with GadgetWidth(Deskstop()) or GadgetHeight(Desktop()).

With those values you are able to detect where a certain window is located. On the first or second display or even in between and send your output accordingly. You could have also one big window across both and split only logical.


ImaginaryHuman(Posted 2009) [#3]
when the 2nd display is bigger than the first in resolution, does gadgetwidth/height return the 2nd display's edge in pixels, or the first? ie how can you reference a screen that is basically this shape:

oO


theHand(Posted 2009) [#4]
When using MaxGui you can detect the size of the first primary monitor with ClientWidth(Desktop()) or ClientHeight(Desktop()) and the complete size (primary and secondary display) with GadgetWidth(Desktop()) or GadgetHeight(Desktop())

Actually, that's not quite right.
ClientWidth(Desktop())
ClientHeight(Desktop())
GadgetWidth(Desktop())
and
GadgetHeight(Desktop())
all seem to display the width/height of the current active desktop (the primary monitor) (assuming extended displays is/are set up, for all of this).
But BlitzMax is able to tell which is the primary desktop, and seems to open new programs on it.
Here is an executable to run, in case you are wondering (and have such a setup): For Windows
Smaller desktops (at smaller resolutions) are clipped off.
Like so:

And it may be for the same reason you don't resize images.
This executable brings up a window, so drag it over "inbetween" and see what I mean.

ImaginaryHuman, you're just the kind of person to devise and run further, more exacting tests on this matter. Figure this out! (although jsp's second paragraph was true, as GadgetX() and GadgetY() do return such values)
Strict

Import MaxGui.Drivers

Local bpchold:Int=0
Local mywindow:TGadget=CreateWindow("Look below",200,200,370,500,Null,WINDOW_TITLEBAR | WINDOW_RESIZABLE)
Local texthold:TGadget=CreateTextArea(15,15,330,330,mywindow,TEXTAREA_WORDWRAP | TEXTAREA_READONLY)
SetGadgetText(texthold,("GadgetWidth() returns:~n"+GadgetWidth(Desktop())+"~nGadgetHeight() returns:~n"+GadgetHeight(Desktop())+"~n------------------------------~nDesktop().width returns:~n"+Desktop().width+"~nDesktop().height returns:~n"+Desktop().height+"~n------------------------------~nClientWidth(Desktop()) returns:~n"+ClientWidth(Desktop())+"~nClientHeight(Desktop()) returns:~n"+ClientHeight(Desktop())+"~n------------------------------~nGadgetX(mywindow) returns: "+GadgetX(mywindow)+"~nGadgetY(mywindow) returns: "+GadgetY(mywindow)+"~n~n------------------------------------------------------------~nPush the button below To check the resolution again.~n~n~nNumber of times button has been pressed: "+bpchold))
Local thebutton:TGadget=CreateButton("Poosh Bootun",135,400,100,50,mywindow,BUTTON_OK)
PollEvent()

While (WaitEvent()<>EVENT_WINDOWCLOSE)
If (CurrentEvent.id=EVENT_GADGETACTION And CurrentEvent.source=thebutton)
	bpchold:+1
	SetGadgetText(texthold,("GadgetWidth() returns:~n"+GadgetWidth(Desktop())+"~nGadgetHeight() returns:~n"+GadgetHeight(Desktop())+"~n------------------------------~nDesktop().width returns:~n"+Desktop().width+"~nDesktop().height returns:~n"+Desktop().height+"~n------------------------------~nClientWidth(Desktop()) returns:~n"+ClientWidth(Desktop())+"~nClientHeight(Desktop()) returns:~n"+ClientHeight(Desktop())+"~n------------------------------~nGadgetX(mywindow) returns: "+GadgetX(mywindow)+"~nGadgetY(mywindow) returns: "+GadgetY(mywindow)+"~n~n------------------------------------------------------------~nPush the button below To check the resolution again.~n~n~nNumber of times button has been pressed: "+bpchold))
EndIf
PollEvent()
Wend


(if mark or some other BRL member is reading this: I'm using an radeon x1600 pro, and whether or not BlitzMax does provide a way to get the "full resolution" is of absolutely no importance to me, as BlitzMax has already exceeded every expectation I had about it.)

Last edited 2011


xlsior(Posted 2009) [#5]
There's also a 3rd part module, DesktopExtension by chaos / (d-bug, hamZta) that adds a bunch of monitor functions, including retrieving their dimensions.

http://www.chaos-interactive.de/de/desktopextension/

multi-platform -- it'll probably do what you need.


theHand(Posted 2009) [#6]
There it is, build it into it and post the code, dude. I am all outta time. :(


jsp(Posted 2009) [#7]
When using MaxGui you can detect the size of the first primary monitor with ClientWidth(Desktop()) or ClientHeight(Desktop()) and the complete size (primary and secondary display) with GadgetWidth(Desktop()) or GadgetHeight(Desktop())


Actually, that's not quite right.



And that is a bug in MaxGui 1.34!

I just tested it and you are right, it gives all the same result while it should not! I started the old 1.28 up and let the code run and it worked correctly as it should.

Seb mentioned once he touched the code and swapped by mistake the Client and the Gadget coordinates, but i thought it was all fixed in the last released.


ImaginaryHuman(Posted 2009) [#8]
I only have 1 monitor ;-)