Page 1 of 2
Element Names changing within Window screens
Posted: Tue Jan 09, 2018 10:31 am
by dkmccammon
I was wondering if there was a fix for the element names that change from time to time on "window" screens?
For example when accessing a window inside of a program an element might have and ID of I_3_7_W1, but then another time accessing the same window inside the same program genie might assign it an ID of I_3_7_W2. Notice the W(#) the number changes sporadically. This makes writing any javascript for the onload funcion a bit challenging because you never know what W(#) the element may be. Also, has it been noticed that these elements on the genie screen are recognized as a W(#) number assigned, but if you look at the raw code for the screens, the number at the end of the W is always dropped off. So using the same element in this example, when on the genie customization screen an element by register as I_3_7_W2, but on the raw code for the screen it will be listed as I_3_7_W. This seems like it could cause some serious issues down the road.
Re: Element Names changing within Window screens
Posted: Tue Jan 09, 2018 11:29 am
by Scott Klement
It changes based on the number of windows on the screen. If it is the first window asked to be displayed, it is W1. If you create a second window while the first one is till there, it is W2, etc. This isn't sporadic or random.
Please understand that Genie is a 5250 emulator. 5250 doesn't know which display file or format or program is running, the system just tells it to display a new window and to put fields/data in that window. It doesn't know anything about the display file, window name, field names, anything elsem just "make a window a print X, Y and Z"
There's no way for Genie to know that it is the same window you used at a different time. And, it has to keep each window separate, so when asked to put a second window on the screen, it has to name it something like W2 instead of W1 to keep it separate.
Re: Element Names changing within Window screens
Posted: Fri Jun 15, 2018 9:27 am
by PaulT
Scott, I understand your answer to the above and I understand how Genie is handling this. Is there a recommended way to handle the varying element names? I have a window with a subfile and a grid. with a onRowClick event that executes a script to update an input field on the screen:
Code: Select all
changeElementValue("I_15_2_W2", row);
pressKey("Enter");
So sometimes the element is "I_15_2_W2" and sometimes "I_15_2_W1".
My thought was to put a couple of changeElementValue instructions in the script; one for W1, another for W2 (and W3 just in case).
Is there a better method?
Re: Element Names changing within Window screens
Posted: Mon Jun 18, 2018 4:21 pm
by Scott Klement
I'm not familiar with your screens, and don't know whether they might have the same elements on them. (For example, it's possible that you'd have two windows that both have an I_15_2 on them, so you might have both I_15_2_W1 and I_15_2_W2 at the same time.)
I'd start by looking to see what screen you're on, and adjust the id based on that.
Re: Element Names changing within Window screens
Posted: Tue Jun 19, 2018 9:30 am
by PaulT
Thanks for the response. Is there documentation that I can access that will show how to determine the screen name in javascript?
Actually, is there documentation that lists the standard Genie element names that can be used in within Genie and javascript?
I have seen the samples in the Genie Development guide, but I was hoping there may be a comprehensive document that I overlooked.
Re: Element Names changing within Window screens
Posted: Tue Jun 19, 2018 9:39 am
by Scott Klement
I'm not sure that I understand. What do you mean by "common Genie element names"?
Re: Element Names changing within Window screens
Posted: Tue Jun 19, 2018 9:43 am
by PaulT
Such as 'row' to refer to the current row number in a grid.
Re: Element Names changing within Window screens
Posted: Tue Jun 19, 2018 10:26 am
by Scott Klement
"row" is a variable that's defined within some of the events in the grid. You'll find information about these variables in the help for the events when you click on the properties on the designer.
Re: Element Names changing within Window screens
Posted: Tue Jun 19, 2018 10:39 am
by PaulT
Ok, thanks.
I am certain there will be more questions as I go along.
Re: Element Names changing within Window screens
Posted: Thu Jun 21, 2018 4:57 pm
by PaulT
So I still have the issue of trying to determine whether the window I am working with is window 1, window 2 or window n.
Is there a way in javascript in Genie for me to know which window I am in?
I have code in a grid to place and 'X' in the selection field of the current row:
Code: Select all
changeElementValue("I_" + (row+2) + "_3_W1", "X");
pressKey("Enter");
But the window in question is now W2 and not W1.
So the above code is not finding the element to be updated.
Thanks for your help and patience.
Paul