Академический Документы
Профессиональный Документы
Культура Документы
raggles.kiwi
Tech
Pretty Stuff
Storytime
Archive
About
These are some of the things that you need to be aware of when developing a multi monitor application:
Each window can only be shown on one monitor at a time (InTouch limitation)
If you try to show a window that is already open on a different monitor, it will close the window on the monitor it was originally on, leaving you with a
blank screen.
$ObjHor and $ObjVer are given in pixels, offset from the top left corner of the view window client area. This is important as when you are viewing the
application on a monitor with a different resolution to the design resolution this must be taken into account.
When using the Show* functions on a monitor of different resolution to the design resolution, same applies as above.
Calling windowstate() on a window right after (ie in the same script) showing or closing the same window will not return the result you are expecting!
You need to configure InTouch to use multiple monitors, you do this in the win.ini file, but here's the trick - there are two win.ini files! The one in C:\Users\
<user>\AppData\Wonderware\win.ini is used by view and window maker, but the wwtechsp.dll library uses the system win.ini file, the location of which
varies by operating system and other settings. The correct file to use is which ever one has been modified by the InTouch installer.
C:\Users\<user>\WINDOWS\win.ini
C:\Windows\win.ini
Append/add a configuration section such as the below to these files, using the appropriate figures for your monitors, NOT your application design resolution
(although on the machine you develop the application, these will be the same).
[InTouch]
MultiScreen=1
MultiScreenWidth=1920
MultiScreenHeight=1080
Create all the windows as if they were going to be on the first monitor, for our example we will use a nominal screen resolution of 1920*1080. Because of the
small amount of room taken up by the menu bar at the top of the screen, the actual window size is 1920*1060. I like to obscure the application menu at
runtime, so I create a popup window called TitleBlock1 that goes over the top, preventing users from accessing the menu unless they login first.
There are some window viewer options that makes things much easier when developing a multi-monitor application. The first one is "Hide Title Bar" which
gets rid of the main window border (which shows up when using multiple monitors), if you don't tick this option you will need to add some logic to handle the
different screen sizes between single and multiple monitors due to the additional window border. The second option is "Always Maximize" which blocks the
taskbar at runtime, and prevents moving the application window around. Actually I don't recommend this one anymore, it can create issues on some systems.
For InTouch standalone, to get the multiscreen working properly the following setting needs to be enabled in the Intouch.ini
EnableScreenResolution=1
For some reason this option seems to be set for Managed Applications but not standalone applications.
When the application starts, it needs to work out how many monitors there are, and what to show on them. The first one is taken care of by the default window,
but if there is a second (or more) monitor, you need to deal with this at startup. We also need to check if our monitors are using the design resolution, or if they
are scaled. In our case we are only going to have two monitors to deal with, so we use this simple snippet:
This QF replaces the Show Window animation, and the various Show functions. It shows a specified window on the monitor from which it was navigated to.
Note you have to tailor this function to your potential monitor arrangements. In our case we will assume a maximum of two monitors, and that they will be
https://raggles.kiwi/wp/?p=864 1/5
14/06/2019 raggles.kiwi » Blog Archive » Creating a multimonitor application in InTouch
side by side. In the event that we try to open a window that is already open on another monitor, we simply show a default window on the other monitor to
prevent it being orphaned.
MMShow(WindowName AS Message)
DefaultWindow = "Default";
WinState = WindowState(WindowName);
IF WinState == 2 THEN
RETURN 0;
ENDIF;
CALL MMAddWindowHistory(WindowName);
To show a window, just use CALL MMShow("WindowName"); in an action script. Using the Show Window animation will not produce the desired results and should
not be used anywhere in the application unless you want to show a window on a fixed monitor.
DefaultWindow = "Default";
WinState = WindowState(WindowName);
IF WinState == 2 THEN
RETURN 0;
ENDIF;
This simply takes the offset as if it were for the first monitor, and if the click originated from the second monitor it adds to the offset so that is shows relative to
the second monitor.
Window History
There are several possibilities for handling page history. Once option is to use overlay windows, and just hide the front most window to go back to the previous
one. I didn't like that idea due to the additional memory requirements of having many windows open at once, and the issue of windows being lost from the
history if they were opened on another monitor. The option I went for was to store the names of the windows in message tags, this meant creating 20 tags (10
for each monitor) and quite a lot of scripting but I was quite satisfied with the result.
There are two scripts that handle the history, one to add a window to the history stack and another to navigate to a previous window.
MMAddWindowHistory(WindowName AS Message)
https://raggles.kiwi/wp/?p=864 2/5
14/06/2019 raggles.kiwi » Blog Archive » Creating a multimonitor application in InTouch
SysMonitor1Window10 = SysMonitor1Window9;
SysMonitor1Window9 = SysMonitor1Window8;
SysMonitor1Window8 = SysMonitor1Window7;
SysMonitor1Window7 = SysMonitor1Window6;
SysMonitor1Window6 = SysMonitor1Window5;
SysMonitor1Window5 = SysMonitor1Window4;
SysMonitor1Window4 = SysMonitor1Window3;
SysMonitor1Window3 = SysMonitor1Window2;
SysMonitor1Window2 = SysMonitor1Window1;
SysMonitor1Window1 = WindowName;
ENDIF;
MMBackWindow
Sample application
I have created a sample application (which has since been improved a bit from the functions above), you can download it here. Included is a standalone
InTouch application and a managed app IDE package - exported using the 2017 Update 2 build. Also included are the required script function libraries (Cursor
Function Library, WW Tech Support Library, and HCInTouch Utilities Library) - you will need to install them into your InTouch Program Files directory for
this application to work correctly.
1. Oleksandr Says:
March 20th, 2017 at 12:35 am
Hi, Thanks for your article this is very good / useful information....
The question is how to do this with minimal changes to the existing project (which was designed for one monitor) ... ???
https://raggles.kiwi/wp/?p=864 3/5
14/06/2019 raggles.kiwi » Blog Archive » Creating a multimonitor application in InTouch
Ideally. One project that can work both on one monitor and two (in Extend mode) ...
ScaleForResolution = 0 and editing Win.ini ... this is understandable ... .and it works ...
But in order for me to realize this way, I need to rewrite the project ... to change
Coordinates of windows? If the main picture is 1280x1024 (with navigation buttons) ... and I want this picture to be displayed on two monitors at once ...
do I need to make a copy of the picture and change the initial coordinates on the second one?
OS Project Editor-> Monitor configuration .... A pair of clicks and the system is configured from the basic project ...
2. Raggles Says:
March 20th, 2017 at 10:00 pm
Hi, firstly: the same window can only be open once, ie you cannot have the same window on two monitors at once. If you want this then you will need to
create duplicate windows which might get a bit messy. The code and sample application the I have developed is aimed at the situation where there is one
distinct window displayed on each screen at a time, plus a small popup window which covers up the title bar. In theory this title bar could be repurposed
as a toolbar. Each window is developed as if it were deployed on the primary monitor, the additional quick functions will move the window position onto
the other monitors as appropriate. I suggest you try out my demo application - I have a slightly later version available that contains a number of bug fixes
- I will upload this some time in the next few days.
3. Joles123 Says:
June 27th, 2017 at 2:25 pm
4. Raggles Says:
June 28th, 2017 at 8:50 am
Sorry I have temporarily removed the source for the utils library, but you can get the binaries from
https://mega.nz/#!XV1lTILC!zQaDHb8ajfR8HZXmnVmIXr-3LxdsFTH_O0-5zyya6Xo. The application package is at
https://mega.nz/#!PIUlXCSb!pogh71FJ1WWy6p_gVJuf4evdi-TNHv61ghzVYoEDC8U
5. Joles1234 Says:
June 30th, 2017 at 11:27 pm
Thanks for that! Got to see if we can apply a similiar approach in a SP2014R2 application where we need to cater for single, dual, and quad display
setups.
6. mikebinz Says:
August 1st, 2017 at 9:16 am
Does anyone know of any similar articles dealing with the implications of running the SAME Intouch Project on DIFFERENT PCs?
7. Kelvin Says:
June 13th, 2018 at 8:57 am
Have tried but get errors when trying to import your application. Wondering if you have just a zipped version and not the Intouch export file available. I
am about to set up a quad system and am familiar with most of the add on tools you mention above, but wanted to experiment a little with your code and
maybe learn something from it that may save me a bunch of time. Thanks,
8. Raggles Says:
June 14th, 2018 at 7:14 am
9. jp Says:
October 23rd, 2018 at 9:41 pm
Hi, I can't seem to import the project. Would you mind exporting the project again?
There is nothing wrong with the file, which version of system platform/intouch are you using?
https://raggles.kiwi/wp/?p=864 4/5
14/06/2019 raggles.kiwi » Blog Archive » Creating a multimonitor application in InTouch
11. jp Says:
October 24th, 2018 at 6:21 pm
I tried to import the aapkg file and the folder, but it shows invalid. I also tried using the find application and pointed it to the unzipped folder but still no
success.
Im using intouch2014r2
I am not able to download the sample project, can you please provide the download link
I tried to import the aapkg file and the folder, but it shows invalid. I also tried using the find application and pointed it to the unzipped folder but still no
success.
Im using intouch2017
I'm not sure why you can't import the file, it works fine for me. Anyways I've converted the application to Standalone InTouch (2017Update2),
unfortunately I've come across a bug that only seems to affect the standalone version so once I've sorted that out I'll upload it.
Hi Raggles,
Could you please upload the latest version, suitable to 2014R2SP1? Thanks!!
I no longer maintain a 2014R2 environment sorry, you could open the application in a demo version of 2017 if you don't have a license.
Hi
I am working on Intouch app on two screen. Is is possible to show same window on both Screens ?
Unfortunately not - a window can only be shown once. If you try to show it again at new coordinates it will disappear from where it was. You could
probably create a duplicate window and show that instead with some fancy logic, but that would mean every time you change the window you have to
copy the changes to the duplicate.
Leave a Reply
Name (required)
Website
Submit Comment
https://raggles.kiwi/wp/?p=864 5/5