Element Names changing within Window screens

Use this board to ask questions or have discussions with other Genie users.
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Element Names changing within Window screens

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Element Names changing within Window screens

Post 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.
PaulT
Profound User
Posts: 20
Joined: Mon Jan 29, 2018 4:58 pm
First Name: Paul
Last Name: Therrien
Company Name: MBI, Inc.
State / Province: Connecticut
Country: United States
Contact:

Re: Element Names changing within Window screens

Post 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?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Element Names changing within Window screens

Post 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.
PaulT
Profound User
Posts: 20
Joined: Mon Jan 29, 2018 4:58 pm
First Name: Paul
Last Name: Therrien
Company Name: MBI, Inc.
State / Province: Connecticut
Country: United States
Contact:

Re: Element Names changing within Window screens

Post 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.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Element Names changing within Window screens

Post by Scott Klement »

I'm not sure that I understand. What do you mean by "common Genie element names"?
PaulT
Profound User
Posts: 20
Joined: Mon Jan 29, 2018 4:58 pm
First Name: Paul
Last Name: Therrien
Company Name: MBI, Inc.
State / Province: Connecticut
Country: United States
Contact:

Re: Element Names changing within Window screens

Post by PaulT »

Such as 'row' to refer to the current row number in a grid.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Element Names changing within Window screens

Post 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.
PaulT
Profound User
Posts: 20
Joined: Mon Jan 29, 2018 4:58 pm
First Name: Paul
Last Name: Therrien
Company Name: MBI, Inc.
State / Province: Connecticut
Country: United States
Contact:

Re: Element Names changing within Window screens

Post by PaulT »

Ok, thanks.
I am certain there will be more questions as I go along.
PaulT
Profound User
Posts: 20
Joined: Mon Jan 29, 2018 4:58 pm
First Name: Paul
Last Name: Therrien
Company Name: MBI, Inc.
State / Province: Connecticut
Country: United States
Contact:

Re: Element Names changing within Window screens

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests