Multi-Monitors with CitectSCADA
(v5.50 and v6.00)
Technical Paper
March 2005
Presented by:
Peter Horsley
Abstract
This document provides information on configuring a Citect v5.50 or v6.00 project (either based on the XP style or the standard templates) to work with multiple monitors. The reason this document is written specifically for v5.50 and above of CitectSCADA is that this version introduced the CSV (XP) style templates in the form of the CSV_Include project, which contains greatly improved multi-monitor functionality. The operating systems on which this document is based are Windows 2000 and XP.
It should be noted that in fact any version of Citect can be used in multi-monitor mode: for details of how to achieve this see Section 2.2.
Contacts
support@citect.com
Contents
1.1 Extended (or expanded) mode
1.2 Spanned (or stretched) mode
2.2 Scenario B – The manual way
3.1 All / new windows appear on the left-most monitor
3.2 Popups appearing on the wrong monitor
3.3 Popups / tooltips appearing split across two monitors
3.4 Effect of [Page]Startup and [MultiMonitors]StartPagex
3.5 Window is crossing onto the next monitor by a few pixels
3.7 Invalid Window prompt on startup
Appendix A: Multi-monitor Cicode Functions
Appendix B: Running in Extended Mode
Purpose
This document provides information on configuring a Citect v5.50 or v6.00 project (either based on the XP style or the standard templates) to work with multiple monitors. The reason this document is written specifically for v5.50 and above of CitectSCADA is that this version introduced the CSV (XP) style templates in the form of the CSV_Include project, which contains greatly improved multi-monitor functionality. The operating systems on which this document is based are Windows 2000 and XP.
It should be noted that in fact any version of Citect can be used in multi-monitor mode: for details of how to achieve this see Section 2.2.
1. Required Hardware
When connecting multiple physical monitors to a PC, there are three possible hardware configurations:
- A dual-head graphics card in spanned mode.
- A dual-head graphics card in extended mode.
- Two single-head graphics cards in extended mode.
1.1 Extended (or expanded) mode
This is the default multi-monitor mode in Windows where all monitors connected to the installed video cards are treated as individual desktops. Each monitor can use different settings (resolution, colour depth, refresh rate and coordinate system). Citect does not support this mode, and it is difficult to achieve correct multi-monitor functionality. However some information on how to do this is provided in Appendix B.
1.2 Spanned (or stretched) mode
This is where all monitors are combined into a single widescreen (or tallscreen) desktop. Each monitor must use the same display settings.
The most important thing to note is that all versions of CitectSCADA only support running in spanned mode, NOT extended mode. You can check which mode you are currently in by doing:
- Start→Run
- Type “asdf” (or any other sequence of random characters)
- If you get a message box that is half on one monitor, half on the other, you are running in spanned mode. If the message box appears in the exact centre of either of the monitors, you are running in extended mode.
To change to spanned mode, right-click the desktop, choose Properties→Settings tab and do the following:
- First make sure the dual-head functionality (called multi-display for Matrox G450 cards) is enabled by clicking Advanced→DualHead tab as indicated by Figure 2 on the next page.
- Back on the Settings tab, choose the dual-head adapter and set the resolution to the complete width of both screens (e.g. 2048x768 – see Figure 1 on the next page. Note that the resolution setting on each screen could be different if you are using two different types of monitors for e.g. 1024x768 and 1280x768 so the complete width of both screens would be 2304x768). This should be configured as the primary monitor.
Figure 1: Spanned Mode
Figure 2: Enabling multi-display
Note that if for some reason you are not able to run in spanned mode (e.g. cost and / or availability of graphics hardware), it is still possible to get Citect working with multi-monitors in extended mode. See Appendix B for information on how to achieve this.
1.3 Number of monitors
To use more than two monitors is simply a case of adding extra dual- or single-head graphics cards; however this document only covers the configuration of two physical monitors. The CSV_Include project is capable of working with up to six monitors. Windows XP itself supports up to 10 monitors. The graphics cards used can be PCI or AGP; however AGP is recommended for performance reasons, especially if large screens are used. Also, the more memory available on the card the better (minimum 16Mb recommended). On-board graphics cards are not recommended and many do not work in multi-monitor mode at all.
2. Setting up your project
There are two scenarios:
A. Your project is based on the XP Style templates.
B. Your project is based on the standard templates.
In both of the above two scenarios, it is important to use pages with the same size as the resolution of one of your monitors. The XP style templates in v5.50 are designed for XGA (1024x768). In v6.00, XP style templates are provided for both XGA and SXGA (1280x1024). Other standard sizes are as follows:
VGA |
640*480 |
SVGA |
800*600 |
XGA |
1024*768 |
SXGA |
1280*1024 |
Further, it is essential in both scenarios that the following two INI parameters are set in your INI file:
[Page] DynamicSizing=0
[Animator] FullScreen=1
Note that when you run Computer Setup Wizard, there is an option to “Display Title Bar” – this is actually the inverse of the setting for [Animator]FullScreen so make sure that is unchecked.
You may be aware that it is possible to integrate some of the CSV functionality into a project based on the standard templates by simply including the “CSV_Include” project manually (in Project Editor→ System→ Included Projects). You should also be aware that mixing templates is not supported (i.e. has not been tested by Citect’s Quality Team) and you have a good chance of running into a variety of issues at runtime. This is also the case with multi-monitors, so this configuration is not recommended.
2.1 Scenario A – The easy way
This is the simplest way to set up multi-monitors in Citect. Just edit your INI file using CiConfig[1][1] or Notepad and add the following three INI parameters under the [MultiMonitors] section (add one if non-existent): or Notepad and add the following three INI parameters under the section (add one if non-existent):
- Monitors = n
Specify how many monitors you are using with the value n.
- ScreenWidth = n
Specify the (horizontal) width of 1 screen (e.g. 1024 if you have two monitors set to this resolution). Note: all monitors must be set to the same width.
- StartupPagen = PageName
For each monitor number (starting from 1), specify the page that should be displayed on startup. E.g. StartupPage1 = MainMenu and StartupPage2 = Alarms.
Then when you run your project, the specified number of pages will be displayed, one on each monitor, and you can browse back and forth throughout the project independently on each monitor. Note that each window is a parent window, and therefore closing any one window will close the runtime down completely. You can implement different functionality by either modifying the templates or handing the shutdown event yourself. Any message boxes that appear will appear on the correct monitor. Super genies should appear in the correct locations, relative to the monitor on which they were opened (e.g. using AssPopUp), as long as they aren’t hard-coded to open at a defined (x, y) position.
You can now also use all the new CSV_MM_* and CSV_* Cicode functions as listed in Appendix A.
2.2 Scenario B – The manual way
You can still achieve multi-monitors in Citect without relying on the CSV_Include functionality, as long as you are prepared to do a little extra tweaking of the project to make everything work (involvement is project dependent). This effectively means you can run multi-monitors in any version of Citect. Note that you still need to be running in spanned (as opposed to extended) mode.
To open up multiple windows on multiple monitors at startup, simply include a call to WinNewAt(“APageName”, x, y) in your startup Cicode function, where x = the horizontal screen coordinate for the start of the next monitor, and y = 0. Note that in some versions of CitectSCADA, a bug is present where if either x or y is specified as 0, the new window gets displayed at (0, 0) on the left-most monitor. If you find this is the case, simply set the x or y argument to 1 instead of 0. This problem has been rectified in v6.00.
The main problem that results from using multi-monitors in this scenario is the positioning of message boxes and other popups, such as super-genies. These appear by default in the centre of the set of monitors, which means the centre of the middle screen if you have three monitors, or halfway across both screens if you have two monitors. The recommend solution to this is to create your own super-genie to fulfil the purpose of a generic message box, and position it manually (using WinNewAt for example) based on the current coordinates of the mouse at the time of invocation (using DspGetMouse for example). The mouse coordinates should be evaluated depending on the number and width of your screens to determine where to position the popup. Alternatively, you can use the WinNumber or WinGetFocus Cicode functions to determine the currently active window number, and use that to determine the best coordinates for the popup.
3. Runtime Issues
Following is a list of known runtime issues when working with mult-monitors. This list should be updated as new issues are discovered. Unfortunately some of these issues are yet to be resolved – they appear here simply as known problems.
3.1 All / new windows appear on the left-most monitor
This is by far the most common problem reported by customers. The first thing to check is whether you are running with spanned or extended mode (see section 1.2). Spanned mode is the only multi-monitors mode supported by Citect at this stage. If you are running in spanned mode, the next thing to do is step through section 2, above. If the instructions provided in section 2 are followed, this problem should not occur. Make sure [Page]DynamicSizing = 0. If it still is a problem, we will need to obtain a copy of the project and INI file, as well as information on version of CitectSCADA, the graphics hardware and operating system being used, and set up a test in-house.
3.2 Popups appearing on the wrong monitor
This occurs when the project is based on the standard templates, and does not occur when the project is based on the XP Style templates. The CSV_Include project contains extra logic (in CSV_Multimonitors.ci) to determine the placement of message boxes and other popups, such as super genies. When using a project based on the standard templates with multi-monitors, you will have to manually cater for all instances of popups. There is a fair amount of scope to do this here, for example, creating an alternative to the Message() cicode function and pops up a super genie with the message depending on the mouse coordinates. See section 2.2 for more information.
3.3 Popups / tooltips appearing split across two monitors
There are two issues here:
a) If the project is based on the standard templates, all child windows are by default sent to the centre of the screen, i.e. the midpoint of the two screens in a two monitor setup. See section 2.2 and 3.2 for the solution.
b) There is a known issue that occurs regardless of whether the project is based on the standard or XP Style templates: tooltips and other popups that rely on the current mouse-coordinates to position themselves do not take into account the split between the physical monitors. For example, if you bring up a tooltip at the very left of the left-most monitor, the tooltip is positioned to the right of the mouse so that is is completely displayed on the screen. If you bring up a tooltip at the very right of the right-most monitor, the tooltip is positioned to the left of the mouse for the same reason. However, currently no intelligent positioning is done to cater for the virtual screen edges as you go from monitor to monitor. The only workaround is to implement your own tooltip / popup control in a genie.
3.4 Effect of [Page]Startup and [MultiMonitors]StartPagex
The page defined in [Page]Startup is displayed first, then the pages defined in [MultiMonitors]StartPagex are displayed, effectively overwriting the former. Note that the [MultiMonitors] parameters are only recognised when running a project based on the XP Style templates.
3.5 Window is crossing onto the next monitor by a few pixels
This is a known issue and is visible whilst the graphics pages are initially displayed. It is caused by the window border making the page size a couple of pixels larger than the screen resolution. As long as [Animator]FullScreen=1, just before the next graphics page is displayed, the window border is removed (along with the titlebar), bringing back the overlap to what looks like about 1 pixel. The next window covers the overlap. This means all windows are effectively shortened width-wise by 1 pixel. There is no solution to this problem at present.
3.6 Template based AN numbers
AN numbers common to multiple pages, such as the reserved AN number 2 for the prompt field, do not behave as expected with multi-monitors. Doing a Prompt(“Hi”) from the kernel only goes to the prompt field of the last opened window, rather than all windows as expected. However, clicking the Login dropdown button in the CSV_Example project and logging in as ‘Engineer’ results in a prompt “Login Successful” always on the first opened window, regardless of which window the command was actually executed from.
3.7 Invalid Window prompt on startup
This appears only when using the [MultiMonitors] INI parameters (i.e. the project is based on the XP Style templates. Further investigation would be needed to determine the cause and whether it is of any importance. On the surface it doesn’t seem to impede any project functionality and can just be ignored.
Appendix A: Multi-monitor Cicode Functions
Historically, the multi-monitor functionality was first introduced into Citect Facilities v5.41. It was then merged into the CSV_Include project supplied with CitectSCADA v5.50. However, the help for v5.50 does not include documentation for any of the CSV_* Cicode functions (including those used for multi-monitors). Interestingly, the help for CitectSCADA v5.42 does contain documentation for some of the functions; but not all appear and the applicability of the documentation to the v5.50 implementation of the functions should not be assumed. The help for CitectSCADA v6.00 does include documentation on all the CSV_* functions, however again the applicability to the v5.50 implementation cannot be assumed. Therefore you are advised to use the v6.00 help (or refer to CSV_IncludeFunctions_v6.00r1.chm) as a guide, and where you get unexpected results, refer to the actual Cicode file (in the CSV_Include project folder) in which the function is defined, and use the function header and code comments as a guide to the correct usage.
Below is a list of CSV_* functions documented as implemented in CitectSCADA v5.50. Where possible, you should use these function in place of their standard versions when running with multi-monitors.
CSV_Alarm.ci Functions:
CSV_Alarms_Sound
CSV_Alarms_SoundActive
CSV_Alarms_CheckSound
CSV_Alarms_Silence
CSV_Alarms_Ack
CSV_Alarms_AckHardware
CSV_Alarms_AckRec
CSV_Alarms_AckPage
CSV_Alarms_Disable
CSV_Alarms_DisableRec
CSV_Alarms_Enable
CSV_Alarms_EnableRec
CSV_Alarms_Help
CSV_Alarms_HelpRec
CSV_Alarms_DspInfo
CSV_Alarms_DspInfoRec
CSV_Alarms_PopupMenu
CSV_Alarms_GetAckPrivilege
CSV_Alarms_GetDisablePrivilege
CSV_Alarms_DspLast
CSV_Alarms_GroupsInit
CSV_Alarms_GroupAdd
CSV_Alarms_GroupRemove
CSV_Alarms_GroupEdit
CSV_Alarms_GroupFilter
CSV_Alarms_DspGroupFilter
CSV_Alarms_GroupSelect
CSV_Alarms_ClearGroupFilter
CSV_Alarms_GetGroupFilter
CSV_Alarms_GetGroupFilterLines
CSV_Alarms_GetGroupFilterID
CSV_Alarms_GetUniqueGroupName
CSV_Database.ci Functions:
CSV_DB_Execute()
CSV_DB_GetExecuteError()
CSV_DB_StandbyConnectionActive()
CSV_DB_GetFieldCount()
CSV_DB_GetFieldName()
CSV_DB_GetFieldIndex()
CSV_DB_GetFieldText()
CSV_DB_GetRowFieldText()
CSV_DB_GetRowCount()
CSV_DB_GetRowCurrent()
CSV_DB_MoveFirst()
CSV_DB_MoveLast()
CSV_DB_MoveOffset()
CSV_DB_MoveNext()
CSV_DB_MovePrev()
CSV_DB_BOF()
CSV_DB_EOF()
CSV_DB_Close()
CSV_DB_StrToSQL()
CSV_Display.ci Functions:
CSV_Display_Logo()
CSV_Display_Version()
CSV_Display_ServicePack()
CSV_File.ci Functions:
CSV_File_Display()
CSV_File_Print()
CSV_File_Save()
CSV_Form.ci Functions:
CSV_Form_Login()
CSV_Form_Shutdown()
CSV_Form_UserCreate()
CSV_Form_UserEdit()
CSV_Form_UserPassword()
CSV_Form_NumPad()
CSV_ListBox.ci Functions:
CSV_ListBox_Create()
CSV_ListBox_Destroy()
CSV_ListBox_AddItem()
CSV_ListBox_RemoveItem()
CSV_ListBox_Clear()
CSV_ListBox_SetText()
CSV_ListBox_Show()
CSV_ListBox_Hide()
CSV_ListBox_SelectCategories()
CSV_ListBox_GetItem()
CSV_ListBox_GetItemID()
CSV_ListBox_GetItemFromID()
CSV_ListBox_GetCategory()
CSV_ListBox_Visible()
CSV_ListBox_SelectTags()
CSV_ListBox_SelectTrends()
CSV_ListBox_TagFormat()
CSV_ListBox_GetTagName()
CSV_ListBox_GetTagComment()
CSV_ListBox_GetTagDescFromTag()
CSV_ListBox_GetTrendDescFromTag()
CSV_Math.ci Functions:
CSV_Math_RoundDown()
CSV_Math_Truncate()
CSV_MenuConfig.ci Functions:
CSV_MenuConfig_Display()
CSV_MessageBox.ci Functions:
CSV_MessageBox()
CSV_Misc.ci Functions:
CSV_Misc_MouseOver()
CSV_Misc_CheckNumPadValue()
CSV_Misc_IntRange()
CSV_MultiMonitors.ci Functions:
CSV_MM_ConfigInit()
CSV_MM_PageDisplay()
CSV_MM_WinNewAt()
CSV_MM_StoreLastPage()
CSV_MM_PageLast()
CSV_MM_ListLastPages()
CSV_MM_PageNext()
CSV_MM_PagePrev()
CSV_MM_MonitorGoto()
CSV_MM_GetMonitor()
CSV_MM_GetOffset()
CSV_MM_GetScreenWidth()
CSV_MM_GetMonitors()
CSV_MM_WinDrag()
CSV_MM_WinDragEnd()
CSV_MM_WinFree()
CSV_MM_WinTitle()
CSV_MM_MonitorFromPoint()
CSV_MM_MonitorFromWindow()
CSV_MM_GetMouseX()
CSV_MM_GetMouseY()
CSV_MM_BackEmpty()
CSV_MM_FwdEmpty()
CSV_MM_NextEmpty()
CSV_MM_PreviousEmpty()
CSV_MM_WinNew()
CSV_MM_PageAlarm()
CSV_MM_PageSummary()
CSV_MM_PageHardware()
CSV_MM_PageDisabled()
CSV_MM_PageFile()
CSV_MM_PageGoto()
CSV_MM_PageSelect()
CSV_Navigation.ci Functions:
CSV_Nav_Parent()
CSV_Nav_ParentBtnEnabled()
CSV_Nav_Home()
CSV_Nav_Network()
CSV_Nav_NetworkBtnEnabled()
CSV_Nav_Trend()
CSV_Nav_TrendMenu()
CSV_Nav_TrendBtnEnabled()
CSV_Nav_TrendX()
CSV_Nav_Report()
CSV_Nav_ReportMenu()
CSV_Nav_ReportBtnEnabled()
CSV_Nav_File()
CSV_Nav_Notes()
CSV_Nav_NotesMenu()
CSV_Nav_NotesBtnEnabled()
CSV_Nav_Tools()
CSV_Nav_ToolsMenu()
CSV_Nav_ToolsBtnEnabled()
CSV_Nav_GetEngToolsPriv()
CSV_Nav_Login()
CSV_Nav_LoginMenu()
CSV_Nav_Help()
CSV_Nav_PagePrint()
CSV_Nav_Shutdown()
CSV_Nav_ShutdownBtnEnabled()
CSV_Nav_Alarms()
CSV_Nav_AlarmsHardware()
CSV_Nav_AlarmsSummary()
CSV_Nav_AlarmsDisabled()
CSV_Nav_DisableMenuItem()
CSV_Nav_TickMenuItem()
CSV_Nav_DisplayMenuBar()
CSV_Nav_DisplayPopupMenu()
CSV_Security.ci Functions:
CSV_Sec_ShowLoginMenu()
CSV_Strings.ci Functions:
CSV_String_Replace()
CSV_String_GetLines()
CSV_Tag.ci Functions:
CSV_Tag_Debug
CSV_Trend.ci Functions:
CSV_Trend_SetTimebase
CSV_Trend_SetScale
CSV_Trend_GetPen
CSV_Trend_GetPenFocus
CSV_Trend_GetCursorPos
CSV_Trend_GetMode
CSV_Trend_GetTime
CSV_Trend_GetDate
CSV_Trend_Exists
CSV_Trend_AutoScale
CSV_Trend_SetDateTime
CSV_Trend_SetTime
CSV_Trend_SetDate
CSV_Trend_SetSpan
CSV_Trend_ChangeTrendScaleAllPens
CSV_Trend_ChangeTrendScaleCurrentPen
CSV_Trend_ChangeTrendScaleCancel
CSV_Trend_Time
CSV_Trend_Cursor
CSV_Trend_GetSpan
CSV_Trend_AddPen
CSV_Trend_DblClick
CSV_Trend_RightClick
CSV_Trend_SetPen
CSV_Trend_SetPen_Delete
CSV_Trend_SetDailySpan
CSV_Trend_Trend_CommTrendRun
CSV_Trend_SetTitle
CSV_Trend_GetSettings
CSV_Trend_SetSettings
CSV_Trend_SetRange
CSV_Trend_SetCursor
CSV_Trend_Refresh
CSV_Trend_Page
CSV_Trend_Win
CSV_Trend_DspTrendText
CSV_Trend_DspScaleRange
CSV_Trend_GetCursorValueStr
CSV_Trend_GetCursorTypeStr
CSV_Trend_UpdatePens
CSV_Trend_CopyTrendDataSet
CSV_Trend_Display
CSV_Trend_Set
CSV_Trend_Get
CSV_Trend_DspList
CSV_Trend_Select
CSV_TrendX.ci Functions:
CSV_TrendX_InitSrvr()
CSV_TrendX_InitClient()
CSV_TrendX_MapTrendTags()
CSV_TrendX_GetVal()
CSV_TrendX_GetTrigger()
CSV_TrendX_Display()
CSV_TrendX_Close()
CSV_TrendX_TrendTimeout()
CSV_TrendX_AddVariable()
CSV_TrendX_ClearTrend()
CSV_TrendX_TagSelectFrmCursor()
CSV_TrendX_TagSelect()
CSV_TrendX_DeletePen()
CSV_TrendX_RefreshTrendPage()
CSV_TrendX_RightClick()
CSV_TrendX_SetPen()
CSV_TrendX_GetTrendName()
CSV_TrendX_GetComment()
CSV_TrendX_GetDuration()
CSV_TrendX_SetDuration()
CSV_TrendX_GetScale()
CSV_TrendX_SetScale()
CSV_TrendX_GetCursor()
CSV_TrendX_GetSamplePeriod()
CSV_TrendX_GetSamplePeriodFrmPen()
CSV_TrendX_SetSamplePeriod()
CSV_WinUtl.ci Functions:
CSV_WinUtl_GetSystemDir()
CSV_WinUtl_GetWindowsDir()
CSV_WinUtl_LockWindowUpdate()
CSV_WinUtl_NormalCursor()
CSV_WinUtl_WaitCursor()
CSV_WinUtl_LoadCursor()
CSV_WinUtl_DestroyCursor()
CSV_CtCicode.ci Functions:
MOUSE FUNCTIONS
DspGetMouseOver()
WINDOW DISPLAY
DspKeepWinPosition()
STRING FUNCTIONS
StrReplace()
StrWordCSV()
StrDateDsp()
Appendix B: Running in Extended Mode
The following KB article shows a way to achieve multi-monitors whilst running in extended mode. Please note that this mode is not supported and not recommended.
Problems in using CitectHMI/SCADA in Multi-Monitor Settings under Extended Desktop Mode
Article
number: Q3735
Created
on: 12/12/2002
Product:
CitectHMI/SCADA Versions
Summary
Configuration:
-------------------
Graphics Card: ATI Radeon 9000
Multi-monitor technology: Hydravision
Multi-monitor mode supported: Extended desktop
OS: Windows 2000
Citect version: 5.41 Spk B
Problems:
--------------
The graphic card driver only supports Extended desktop mode, while its 7000 series only supports stretched mode in Windows 2000. As I understand, this mode allows different monitors to use different resolutions, and the windows task bar will only appear on the primary monitor. Under this mode the following problems were observed:
1. WndInfo(0) or WndInfo(1) only reports the resolution of the primary monitor (not the entire desktop)
2. If the size of the window is larger than the resolution of the monitor. If you use WinPos() to move the window beyond the primary monitor. Only the portion of the window that is within the primary monitor is shown, ie. the window is clipped within the boundary of the 1st monitor. However, if you manually drag the window to the 2nd monitor, the window will be shown normally. (not sure if this is graphics card related.)
3. For window that is smaller or equal to the resolution of the monitor, you can still use WinPos() to move it to the 2nd monitor. However, if you call WinNewAt(), WinSize(), WinMove(), WinMode() etc. to manipulate the window, the window automatically get sent back to the (-4,-4) coordinates of the primary monitor.
4. When the window is located in the 2nd monitor, calling WinSize() sometimes will result the window to be shrinked to 0 x 0 size, and disappear from the monitor.
Back then, we prevent the above problems by using the Windows 2000 driver of the 7000 series graphic card which supports Stretched desktop mode. In this mode, all monitor use the same resolution, and Window treat the two monitors as a single widescreen display and report its resolution as the combined res. of the monitors, eg. for 2 1280 x 1024 res. monitors, Windows reports 2560 x 1024 resolution for the screen area. In this mode, Citect work normally as expected.
Earlier we received an email from David Mifsud about how to get Mult-monitor working on Windows XP on Matrox card. This became a bit clear that the screen was under the stretched desktop mode settings.
Solution
Workarounds:
-------------------
1. Use a graphic card that supports stretched desktop mode, such as Matrox, Nvidia card.
2. After a bit of experimentation, we came up with a workaround to use multi-monitors under Extended desktop mode. It is purely based on the assumption that WinPos() will still work if the window is smaller and equal to the resolution of the monitor. The idea is to ensure the size of all Citect windows is smaller or equal to that of monitor. call the suggested MM_AdjustWindow() function after any Windows manipulation Cicodes, ie.
WinNewAt(), WinNew(), WinMove(), PagePopup(), TrendWin(), TrendPopup(), AssPopup(), etc.
PageDisplay(), PageGoto(), PageLast(), PageNext(), PagePrev() , PageTrend(), PageAlarm(), PageHardware(), PageFile(), etc. (they tend to resize the window back to the intended resolution of the page)
The Cicode is designed to work under the following Citect.ini settings:
[Animator]
WinNoScrollbars=1 ! Do not show scroll bars
when window is resized
[Page]
Dynamicsizing=0 ! Do not dynamically resize
(rescale) page.
FUNCTION
MM_AdjustWindow(INT iMonitorWidth, INT
iMonitorHeight, INT iXPos, iYPos)
IF
StrToInt(PageInfo(12)) > iMonitorWidth OR StrToInt(PageInfo(13))
> iMonitorHeight THEN
WinSize(0,
0) // Somehow this is required
WinMove(iXPos,
iYPos, iMonitorWidth, iMonitorHeight);
//
Resize the window including the window
frame
END
// Reposition the
window to destination
IF iXPos >=
iMonitorWidth OR iYPos >= iMonitorHeight
THEN
WinPos(iXPos,
iYPos);
END
END
When you need to resize a window, i.e.. calling WinSize(), it is quite likely that the window will not be resized, and simply cause the window to be sent to (-4,-4) of the primary monitor. To ensure your WinSize() resize the window on the spot, call the following function instead:
FUNCTION
MM_WinSize(INT iXSize,
iYSize)
INT iXPos,
iYPos;
// Remember exisiting
position of the window
iXPos =
StrToInt(PageInfo(14));
iYPos =
StrToInt(PageInfo(15));
// Resize the
window
WinSize(iXSize,
iYSize); // the 1st WinSize() may just send the window to 1st
monitor
WinSize(iXSize,
iYSize); // the 2nd WinSize() ensure the window is resized
properly
WinPos(iXPos, iYPos);
// reposition the window to original position
END
Disclaimer
Disclaimer of All
Warranties
SCHNEIDER ELECTRIC (AUSTRALIA) PTY LTD DISCLAIMS ANY AND ALL
WARRANTIES WITH RESPECT TO SCHNEIDER ELECTRIC (AUSTRALIA) PTY LTD
PRODUCTS AND THE RELATED DOCUMENTATION, WHETHER EXPRESS OR IMPLIED,
INCLUDING SPECIFICALLY THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A GENERAL OR PARTICULAR PURPOSE. CITECTSCADA AND
THE RELATED DOCUMENTATION ARE PROVIDED "AS IS," AND YOUR COMPANY
UNDERSTANDS THAT IT ASSUMES ALL RISKS OF THEIR USE, QUALITY, AND
PERFORMANCE.
Disclaimer of
Liability
YOUR COMPANY AGREES AND ACKNOWLEDGES THAT SCHNEIDER ELECTRIC
(AUSTRALIA) PTY LTD SHALL HAVE NO LIABILITY WHATSOEVER TO YOUR
COMPANY FOR ANY PROBLEMS IN OR CAUSED BY SCHNEIDER ELECTRIC
(AUSTRALIA) PTY LTD PRODUCTS OR THE RELATED DOCUMENTATION, WHETHER
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL (INCLUDING
LOSS OF PROFITS).
Related Links
Attachments