Vision2 - how to find out dimensions of current screen (not whole virtual space)

10 views
Skip to first unread message

Thomas Beale

unread,
May 29, 2020, 4:20:46 PM5/29/20
to Eiffel Users

I'm coming back to some code after a few years. Peter Gummer and I wrote a lot of wrapping code for EV_GRID, and one of the things we never managed to do was make it so that dialogs containing grids had proper size and resize behaviour, no matter how large or small the content might be.

A basic need is to find out the dimensions of the current physical screen on which the application is displayed, so as to calculate some reasonable maximum size for dialogs, grids etc. I don't want the total virtual space, which I believe encompasses all screens (most people have two these days) - I want the size of the current screen.

Anyone know where I can find these numbers?

Thanks in advance.

Alexander Kogtenkov

unread,
May 29, 2020, 4:52:25 PM5/29/20
to eiffel...@googlegroups.com
I’m not an expert in Vision library, but given that it’s unclear what "current screen" means for a window that can be shown at two or more physical monitors at the same time, would the following work?
  1. Send a message to maximize current window (or a child window; maybe, even invisible windows are possible).
  2. Retrieve window dimensions and use them as needed.
  3. Restore (or hide, or destroy) the current (child/temporary) window.
Alexander Kogtenkov
 
 
Thomas Beale <wolan...@gmail.com>:

Thomas Beale

unread,
May 30, 2020, 6:42:11 AM5/30/20
to Eiffel Users
Hi Alexander,
well let's be a bit more abstract about the problem.
I have an application that started up with some 'reasonable' outer window dimensions. Ideally it would be on a single physical monitor (i.e. not crossing the boundary over two monitors). Now I just want to make sure that a dialog box (particularly the kind containing an EV_GRID, with potentially voluminous content) will have a reasonable size, within the size of the application.

I've got other ways of doing that, including a routine that figures out the dimensions of the proximate EV_WINDOW of a widget.

It would be nice if all this simple stuff were not so manual all the time...

- thomas

Now I could just check the application's initial window dimensions on start up

Thomas Beale

unread,
May 30, 2020, 6:46:01 AM5/30/20
to Eiffel Users
I just rediscovered a routine EV_SCREEN.monitor_area_from_window (a_window: EV_WINDOW): EV_RECTANGLE which my code was already calling. Doesn't work however. Investigating...


On Friday, 29 May 2020 21:52:25 UTC+1, Alexander Kogtenkov wrote:

Ulrich Windl

unread,
Jun 4, 2020, 2:15:18 AM6/4/20
to eiffel...@googlegroups.com
>>> "'Alexander Kogtenkov' via Eiffel Users" <eiffel...@googlegroups.com>
schrieb am 29.05.2020 um 22:52 in Nachricht
<26863_1590785543_5ED17607_26...@f720.i.mail.ru>:

> I’m not an expert in Vision library, but given that it’s unclear what
> "current screen" means for a window that can be shown at two or more
physical
> monitors at the same time, would the following work?

I don't have multiple monitors, but I guess the "screen size" is the size that
a window assumes when put in "full screen" mode.
Could be "single monitor" or spanning multiple monitors. I can't test...

> * Send a message to maximize current window (or a child window; maybe, even

> invisible windows are possible).
> * Retrieve window dimensions and use them as needed.
> * Restore (or hide, or destroy) the current (child/temporary) window.
> Alexander Kogtenkov
>
>
>>Thomas Beale <wolan...@gmail.com>:
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Eiffel Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to eiffel-users...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/eiffel-users/1590785542.709125960%40f720.i.
> mail.ru.



Ulrich Windl

unread,
Jun 4, 2020, 2:27:22 AM6/4/20
to eiffel...@googlegroups.com
>>> Thomas Beale <wolan...@gmail.com> schrieb am 30.05.2020 um 12:46 in
Nachricht
<12860_1590835562_5ED2396A_12860_63_1_415479f4-929c-480e-bac4-f297df9c2928@googl
groups.com>:
> I just rediscovered a routine EV_SCREEN.monitor_area_from_window (a_window:

> EV_WINDOW): EV_RECTANGLE which my code was already calling. Doesn't work
> however. Investigating...

As a small side-note: With Windows 10 and Display Port you cannot use a
(simple, i.e. cheap) KVM-switch any more: Windows "detects" that the KVM switch
has disconnected the monitor, and in turn moves most windows to the upper left
corner, resizing them to to something like 800x600, or maybe 1024x768. At least
it does not restore the window positions when the monitor (FHD) is back.
I wonder: What sense does it make to redroaw windows when a monitor is not
connected? IMHO WIndows should delay any action untils a monitor IS connected
after a disconnect. The amazing world of Windows concepts...

Regards,
Ulrich
P.S. They say some KVM switches do exist that do not disconnect the monitor
connection as seen from the OS...

>
> On Friday, 29 May 2020 21:52:25 UTC+1, Alexander Kogtenkov wrote:
>>
>> I’m not an expert in Vision library, but given that it’s unclear what
>> "current screen" means for a window that can be shown at two or more
>> physical monitors at the same time, would the following work?
>>
>> 1. Send a message to maximize current window (or a child window;
>> maybe, even invisible windows are possible).
>> 2. Retrieve window dimensions and use them as needed.
>> 3. Restore (or hide, or destroy) the current (child/temporary) window.
>>
>> Alexander Kogtenkov
>>
>>
>>
>> Thomas Beale <wolan...@gmail.com <javascript:>>:
>>
>>
>> I'm coming back to some code after a few years. Peter Gummer and I wrote a

>> lot of wrapping code for EV_GRID, and one of the things we never managed to

>> do was make it so that dialogs containing grids had proper size and resize

>> behaviour, no matter how large or small the content might be.
>>
>> A basic need is to find out the dimensions of the current physical screen
>> on which the application is displayed, so as to calculate some reasonable
>> maximum size for dialogs, grids etc. I don't want the total virtual space,

>> which I believe encompasses all screens (most people have two these days) -

>> I want the size of the current screen.
>>
>> Anyone know where I can find these numbers?
>>
>> Thanks in advance.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Eiffel Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to eiffel-users...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/eiffel-users/415479f4-929c-480e-bac4-f297df

> 9c2928%40googlegroups.com.



r...@amalasoft.com

unread,
Jun 4, 2020, 7:47:57 AM6/4/20
to eiffel...@googlegroups.com
I have a Belkin SOHO switch and the only issue with Windows 10 is when it reboots and that system is not presently connected to the monitor, it uses default positions (there is no way for it to know, in advance, what resolution I might select in the future).  It never moves windows around once connected; nor does it revert to default resolution.
R
Reply all
Reply to author
Forward
0 new messages