How to open a window on a second screen ?

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

How to open a window on a second screen ?

Postby marten » Tue Feb 09, 2010 5:57 am

After buying a new graphic card and adding a second LCD monitor I asked myself: how can I create an open a VASmalltalk top shell on a second screen or monitor or device ?
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: How to open a window on a second screen ?

Postby TriSebastian » Sun Feb 21, 2010 3:03 am

Hi Marten,

I think this isn't supported, yet.

But nothing is impssible at VASmalltalk ;-)

I think you might have to extend VAST a little.
There are several C++ / OpenGL tutorials on the web, which explain how to open a Widget on the second display.

I think you might need to add the following Plattformfunctions and OSObjects to VAST.
EnumDisplayMonitors()
MonitorEnumProc()
GetMonitorInfo()

For the GetMonitorInfo()-call you might be able to use the already existing classes OSMonitorInfo1 and 2. Have a look at OsDevmode on how to use them.

C++ Sample:
MONITORINFOEX monitorinfo;
monitorinfo.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo( hMonitor, &monitorinfo );
long x, y, width, height;
x = monitorinfo.rcMonitor.left;
y = monitorinfo.rcMonitor.top;
width = monitorinfo.rcMonitor.right - monitorinfo.rcMonitor.left;
height = monitorinfo.rcMonitor.bottom - monitorinfo.rcMonitor.top;

HWND hWnd = CreateWindow( classname, monitorinfo.szDevice,
WS_POPUP|WS_VISIBLE,
x, y, width, height,
NULL,
NULL,
hInstance,
NULL);

Here's an example on how to swith the resolution of your screen. It uses the OSDevMode for this.
|devmodePtr |
devmodePtr := OsDevMode new
dmSize: self class fixedSize;
dmDriverExtra: 0.

"Getting the actual devMode to be changed and set later on."
OS
enumDisplaySettings: nil
iModeNum: -1 "get current mode"
lpDevMode: devmodePtr.
"You could alsocollect all available devmodes on you system by iterating from 1 to xyz changing the iModeNum until the OSCall returns false.
Using the devmode you desire calling the changeDisplaySettings"

"Changing the resolution values"
devmodePtr
dmPelsWidth: 800;
dmPersHeight: 600;
dmFields: DmPelswidth|DmPelsheight|DmBitsperpel|DmDisplayfrequency.

(devmodePtr changeDisplaySettings: CdsTest) ~= 0 ifTrue:[^self error: 'Wasn't able to change the Devmode'].
devmodePtr changeDisplaySettings: CdsFullscreen.


I think using MonitorInfo might work like this, too.
CreateDC should then also be done on the handle of your second monitor.

Well, a lot to do, but not impossible ;-)

Cheers!
Sebastian
TriSebastian
 
Posts: 76
Joined: Sun Jul 20, 2008 9:40 pm
Location: Nanaimo, BC, Canada

Re: How to open a window on a second screen ?

Postby Michael Keppler » Wed May 26, 2010 1:05 am

I'm not sure what the problem is that you experience. At least on Windows, the desktop is a single logical window, which covers all your screen devices. So just by setting the pixel position of the shell, the window will occur wherever you want it. There is no difference between the first and any other screen.
Michael Keppler
 
Posts: 28
Joined: Wed Feb 27, 2008 4:33 am

Re: How to open a window on a second screen ?

Postby rjs » Sun May 30, 2010 10:21 pm

Michael Keppler wrote:I'm not sure what the problem is that you experience. At least on Windows, the desktop is a single logical window, which covers all your screen devices. So just by setting the pixel position of the shell, the window will occur wherever you want it. There is no difference between the first and any other screen.


That's my observation, too - at least, when configuring it as a single window. There are other options.

VA version 6, and probably more recent versions, have a problem with this. If one developer uses the Composition Editor to edit a part on the extended portion of the display, other developers cannot see it. (Yes, one can use the Windows system menu Move option, but that is a PITA and does require everyone to recognize what's happening first.) The problem is that VA saves the window position when editing a part and blithely re-opens the part at the same position, even on machines which don't have a screen as large as the original.

I don't have the specific method name to hand, but it is fairly easily found and equally easily "corrected" to coerce the window position onto the available window area.
rjs
 
Posts: 39
Joined: Thu Mar 27, 2008 11:07 am
Location: Port Perry, Ontario, Canada


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest