1/18/2013 12:44 AM | |
Joined: 11/4/2011 Last visit: 8/25/2024 Posts: 253 Rating: (53) |
Hi! I want to share my idea with you. I've changed the script that opens Area Tree (Down Button next to the Area Button) so that now this new small window is moved to the right under the corresponding Area Button. I think it is more convenient (easier, faster) to get to the Tree window now. To use it in every project you should replace @AreaButtons.pdl in the folder: C:\Program Files\SIEMENS\WINCC\Options\PDL\Base_Data_Pool\ and run OS Project Editor to recreate @AreaButtons.pdl If you want just test the script on one project on some of the Area Buttons then just open the @AreaButtons.pdl in your project and replace the Mouse Action script of the object named @ToAreaGroup. In the attachment you will find: @AreaButtons.PDL - new picture @AreaButtons.sav - old backup ToAreaGroup script.txt - just the script So the script: [code]char szAreaButton[15] = "@AreaButton"; char szIndex[2] = ""; int iIndex = 0; int iLeft = 0; SSMShowTreeEx(lpszPictureName, lpszObjectName, 0); // system function // Terminal_Buzz Code: Move PTN_Tree window under it's AreaButton iIndex = SSMGetIndexFromObject(lpszObjectName); sprintf(szIndex, "%2d", iIndex); strcat(szAreaButton, szIndex); iLeft = GetLeft(lpszPictureName, szAreaButton); SetLeft("@SCREEN.@WIN12:@1001", "@PTN_TREE", iLeft);[/code] AttachmentToAreaGroup script.zip (295 Downloads) |
Last edited by: TerminalBuzz at: 1/18/2013 12:46 AMбублик |
|
This contribution was helpful to1 thankful Users |
1/18/2013 9:44 AM | |
Joined: 3/14/2008 Last visit: 11/3/2024 Posts: 2121 Rating: (949) |
Nice idea... thx for sharing... |
If I could help you, you can use the RATE button. Thank you. |
|
1/19/2013 1:51 AM | |
Joined: 11/4/2011 Last visit: 8/25/2024 Posts: 253 Rating: (53) |
Oops, it is working just at the first monitor because of the rough text parameter with PictureName. I have two in my project.. So the code has got a new look now: [code] TCHAR *lpszParentPic = NULL; TCHAR *lpszParentPicWindow = NULL; TCHAR szPicture[30] = "@SCREEN."; TCHAR szAreaButton[15] = ""; int iIndex = 1; int iLeft = 0; SSMShowTreeEx(lpszPictureName, lpszObjectName, 0); // system function // Terminal_Buzz Code: Move PTN_Tree window under it's AreaButton lpszParentPic = GetParentPicture(lpszPictureName); lpszParentPicWindow = GetParentPictureWindow(lpszParentPic); iIndex = SSMGetIndexFromObject(lpszObjectName); sprintf(szAreaButton, "%s%2d", "@AreaButton", iIndex); iLeft = GetLeft(lpszPictureName, szAreaButton); strncat(szPicture, lpszParentPicWindow, strlen(lpszParentPicWindow)-1); strcat(szPicture, "2:@1001"); SetLeft(szPicture, "@PTN_TREE", iLeft);[/code] But I've decided to move this code into that system function and leave the @AreaButtons.pdl unchanged. So now the file SSMShowTreeEx.fct looks like: [code]#pragma option (mbcs) #include "apdefap.h" BOOL SSMShowTreeEx(char* lpszPictureName, char* lpszObjectName, int iAreaIndex) { #pragma code("ssmrt.dll") #include "ssmrt.h" #pragma code() #pragma code("PTN_RT.dll") #include "PTN_RT_API.h" #pragma code() int iIndex = 0; TCHAR strPictureName[260] = ""; TCHAR strServerPictureName[260] = ""; TCHAR ContainerNameA[260] = ""; TCHAR ContainerNameB[260] = ""; TCHAR *pszPrefix = NULL; // Terminal_Buzz variables TCHAR *lpszParentPic = NULL; TCHAR *lpszParentPicWindow = NULL; TCHAR szPicture[30] = "@SCREEN."; TCHAR szAreaButton[15] = ""; int iLeft = 0; BOOL ret; // end of TBv BOOL bArea = FALSE; CMN_ERROR Err; if ( NULL == lpszPictureName ) { printf ("Invalide Parameter in SSMShowTreeEx\r\n"); return FALSE; } if ( !SSMGetAreaFromWorkField(SSMGetScreen(lpszPictureName), ContainerNameA, sizeof(ContainerNameA)) ) printf (" Error in SSMShowTree1\r\n"); if (NULL == lpszObjectName) iIndex = iAreaIndex; else iIndex = SSMGetIndexFromObject(lpszObjectName); if ( 0 == iIndex ) return FALSE; if ( !SSMGetAreaFromIndex(iIndex, ContainerNameB, 260, strPictureName, 260) ) printf (" Error in SSMShowTree1\r\n"); if ( '\0' != ContainerNameA[0] && '\0' != ContainerNameB[0] && 0 == strcmp (ContainerNameA, ContainerNameB ) ) bArea = TRUE; GetServerTagPrefix(&pszPrefix,NULL,NULL); if ( pszPrefix && NULL == strstr(strPictureName, "::") ) { strncpy(strServerPictureName, pszPrefix, 260); strncat(strServerPictureName, strPictureName, 260); } else { strncpy(strServerPictureName, strPictureName, 260); } ret = PTN_SHOW_TREE(lpszPictureName, "@PTN_Tree", strServerPictureName, bArea ,&Err); // Terminal_Buzz code: Move PTN_Tree window under it's AreaButton lpszParentPic = GetParentPicture(lpszPictureName); lpszParentPicWindow = GetParentPictureWindow(lpszParentPic); sprintf(szAreaButton, "%s%2d", "@AreaButton", iIndex); iLeft = GetLeft(lpszPictureName, szAreaButton); strncat(szPicture, lpszParentPicWindow, strlen(lpszParentPicWindow)-1); strcat(szPicture, "2:@1001"); SetLeft(szPicture, "@PTN_TREE", iLeft); // end of TBc return ret; }[/code] It is weird too, but still working :) Attachment Move_PTNtree.zip has next files:
The readme says: These files could allow you to add a new feature to your project. The PTN_Tree window could be opened right under the corresponding Area Button and not on the left side all the time (as it is now). AttachmentMove_PTNtree.zip (250 Downloads) |
This contribution was helpful to5 thankful Users |
Follow us on