Board index » delphi » Re: screen dispay

Re: screen dispay


2007-03-30 09:50:51 PM
delphi175
grahamo writes:
Quote
we have a user thats complaining that when they run our application
with TWO monitors in place and they subsequently run it with just ONE
monitor in place, its no longer visible.
It could be that the second monitor is unplugged, turned off, or simply
not visible because they are remotely controlling the machine with only
one remote monitor. In this case whatever logic you have in place
might think that the second monitor is still visible.
Also, keep in mind that your current code only tests Screen.Width which
is the width of the primary monitor. To find out about other monitors
you really need to check each one individually. Here's some code I
just wrote to gather information about the monitors:
var
SL : tStringList;
i : integer;
begin
SL := tStringList.Create;
try
SL.Add(Format('Screen.Width %d', [Screen.Width]));
SL.Add(Format('Screen.Height %d', [Screen.Height]));
SL.Add(Format('Form.Left %d', [Left]));
SL.Add(Format('Form.Top %d', [Top]));
SL.Add(Format('Monitor Count %d', [Screen.MonitorCount]));
for i := 0 to Screen.MonitorCount-1 do begin
SL.Add(Format('Screen.Monitors[%d] Width %d', [i,
Screen.Monitors[i].Width]));
SL.Add(Format('Screen.Monitors[%d] Height %d', [i,
Screen.Monitors[i].Height]));
SL.Add(Format('Screen.Monitors[%d] Monitor Num %d', [i,
Screen.Monitors[i].MonitorNum]));
if Screen.Monitors[i].Primary then
SL.Add(Format('Screen.Monitors[%d] Primary', [i]))
else
SL.Add(Format('Screen.Monitors[%d] Not Primary', [i]));
end;
finally
SL.SaveToFile('MonitorData.txt');
SL.Free;
end;
end;
Here's what it just reported on my system:
Screen.Width 1280
Screen.Height 1024
Form.Left 346
Form.Top 114
Monitor Count 2
Screen.Monitors[0] Width 1280
Screen.Monitors[0] Height 1024
Screen.Monitors[0] Monitor Num 0
Screen.Monitors[0] Primary
Screen.Monitors[1] Width 1280
Screen.Monitors[1] Height 1024
Screen.Monitors[1] Monitor Num 1
Screen.Monitors[1] Not Primary
--
-Mike (TeamB)
 
 

Re: screen dispay

Hi,
Each time we start/stop our application, we read/write the coordinates of the app window in a config file. i.e each time the app is relaunched, we display it in the same location it was displayed previously. Fair enough, no problem.
we have a user thats complaining that when they run our application with TWO monitors in place and they subsequently run it with just ONE monitor in place, its no longer visible.
I immediately went into the source, assuming we didn't check the coordinates to be used when displaying (taking into consideration the screen width etc.). However I see that our code already takes this into consideration; i.e. we have;
if (Top>(Screen->Height - 10))
Top = 0;
if (Left>(Screen->Width - 10))
Left = 0;
This puzzles me. with the above logic, already in place, can anybody suggest why the window should not be visible when the user saves on a dual monitor setup and then subsequently restart the app on a single monitor.
thanks much for any tips/ideas.
have a nice day
GrahamO
 

Re: screen dispay

Hi,
"grahamo" <XXXX@XXXXX.COM>writes
Quote

Hi,

Each time we start/stop our application, we read/write the coordinates of
the app>window in a config file. i.e each time the app is relaunched, we
display it in the same>location it was displayed previously. Fair enough,
no problem.
I do the same in my applications.
Quote
we have a user thats complaining that when they run our application with
TWO>monitors in place and they subsequently run it with just ONE monitor
in place, its no>longer visible.
From what I have seen, this is normal.
If you right click on the desktop and go to the video settings, you
"should" see
that the desktop has been setup to extend across both monitors.
Unplugging the second monitor does NOT change this (not even if you reboot).
All the user has to do is to go into the screen settings and turn off that
specific setting and restart your application.
Your application, can then (on startup), do a simple check to determine
if it is off the screen and reposition the window.
I don't know of any other way to handle this because Windows (XP)
continues to indicate 2 monitors present even if one is NOT when
it is setup to extend the desktop across multiple monitors.
Best Regards
 

Re: screen dispay

grahamo writes:
Quote

if (Top>(Screen->Height - 10))
Top = 0;
if (Left>(Screen->Width - 10))
Left = 0;
What if Top and/or Left is negative? I think the left screen will have
negative coordinates when the right one is the primary.
--
Anders Isaksson, Sweden
BlockCAD: web.telia.com/~u16122508/proglego.htm
Gallery: web.telia.com/~u16122508/gallery/index.htm
 

Re: screen dispay

grahamo writes:
Quote

Hi,

Each time we start/stop our application, we read/write the
coordinates of the app window in a config file. i.e each time the app
is relaunched, we display it in the same location it was displayed
previously. Fair enough, no problem.

we have a user thats complaining that when they run our application
with TWO monitors in place and they subsequently run it with just ONE
monitor in place, its no longer visible.

I immediately went into the source, assuming we didn't check the
coordinates to be used when displaying (taking into consideration the
screen width etc.). However I see that our code already takes this
into consideration; i.e. we have;

if (Top>(Screen->Height - 10))
Top = 0;
if (Left>(Screen->Width - 10))
Left = 0;

This puzzles me. with the above logic, already in place, can anybody
suggest why the window should not be visible when the user saves on a
dual monitor setup and then subsequently restart the app on a single
monitor.
Because the monitor the form was displayed on may have been mapped to
negative coordinates...
--
Peter Below (TeamB)
Don't be a vampire (slash7.com/pages/vampires),
use the newsgroup archives :
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be