I’m currently working on a chat feature that will have a chat icon at the bottom right corner. This chat icon will also expand to show any new message that are received. When it is clicked on it will resize back to the small icon and open a chat window. This small icon is a small floating window that I set the size and location for when ever the client is opened or a new message is received. Here is a snippet of my code:
window_chat = system.gui.getParentWindow(event)
window_1 = system.gui.getWindow("Navigation Bar")
windows = ["Home", "Process Overview", "Series 100", "Series 200", "Series 300", "Series 400", "Series 500", "Series 600", "Series 700", "Lab", "Trends", "Operators", "Reports"]
window_list = system.gui.getOpenedWindowNames()
for w in window_list:
if w in windows:
window_2 = system.gui.getWindow(w)
window.setLocation(window_2.width - window_chat.width, (window_2.height + window_1.height) - window_chat.height)
For this project there are always 2 maximized windows open. One of them is always the Navigation Bar (window_1) docked to the north and the other is a maximized floating window from the list variable “windows”. I determine from that list which window is open to get the second window (window_2). The variable “window” is the chat icon window (i have another script that will change this to a larger window to show the message). In the last line I use the two maximized windows (window_1 and window_2) to figure out the entire size of the project and subtract the size of window_chat to get the correct location.
The clients are all launched in Window mode so I can’t use the size of the computer screen to set the location, would be a lot easier if I could (I think).
I’ve been able to get this to work really well on most computers but there is one user who I am having a trouble getting it working for. It will still display the window but it will put it off the screen so that the user now has to scroll to see everything. Never had to before. And he only has to scroll vertically, the horizontal positioning of the window is fine. It appears to be placing the chat window 80-100 pixels too low. The user is using a Laptop with Windows 7. I have gotten this to work on my desktop computer that has Windows 7 just fine, also works on my Mac. I could make a special case for this user to fix it but I would rather not do that. Any input would be appreciated.