Bug #2269
EQ2UIPage - Support for proper naming
Description
This applies to ALL EQ2UIPage files. I'm going to use the choice window because it's very small and a basic example, but it applies to all eq2uipages.
There's two ways to access EQ2UIPage windows. Using the proper name, or using the global element. They do work a little bit differently, and various times one will work and the other won't, then vise versa.
In this example, I simply right click on an item in my inventory and choose destroy. It pops up a "Are you sure you want to destroy this item?" (choice window). In this example, we can access it using either naming convention.
Filename: eq2ui_hud_choice.xml
The "proper" name of this, is using "HUD". (Which we can see by looking into "eq2ui_hud.xml" and seeing the name <Page AbsorbsInput="false" BackgroundColor="#FFFFFF" ismodule="true" Name="HUD"
Other common names are "MainHUD", "Popup" etc (again, all based on the UI files/their names).
The global element, is named "_HUD" (with an underscore at the start).
Here is the sample:
echo Underscore HUD
echo ${EQ2UIPage[_HUD,choice].Child[page,_HUD.choice](type)}
echo ${EQ2UIPage[_HUD,choice].Child[page,_HUD.choice].NumChildren}
echo Just HUD
echo ${EQ2UIPage[HUD,choice].Child[page,HUD.choice](type)}
echo ${EQ2UIPage[HUD,choice].Child[page,HUD.choice].NumChildren}
Results:
Underscore HUD
eq2uipage
11
Just HUD
eq2uipage
0
Here we can see, by either name, we can access the window (the part that returns eq2uipage).
However, _HUD reports .NumChildren of 11, whereas HUD reports 0.
We can take this further. Looking at the choice1 button (Destroy, in this example):
echo Underscore HUD
echo ${EQ2UIPage[_HUD,choice].Child[Button,_HUD.Choice.Choice1]}
echo ${EQ2UIPage[_HUD,choice].Child[page,_HUD.choice].Child[3]}
echo Just HUD
echo ${EQ2UIPage[HUD,choice].Child[Button,HUD.Choice.Choice1]}
echo ${EQ2UIPage[HUD,choice].Child[page,HUD.choice].Child[3]}
Results:
Underscore HUD
eq2button
eq2button
Just HUD
eq2button
NULL
When accessing by name (.Choice.Choice1), using either method works fine.
However, when we try to access by number (.Child[3]), only _HUD works, HUD does not. I suspect this is because HUD reports .NumChildren as 0.
As mentioned above, this applies to ALL EQ2UIPage windows, including the more complex. While I can usually just use _HUD or get the information using _HUD, then convert it to HUD using the name. However, this is not always possible.
For example, using .Child[#,name], doesn't work (for the windows that have the same name)
* The "Child" MEMBER of the 'eq2uipage' datatype now has the following syntax only:
1. Child["name"] <- Chooses the first child with the name provided
2. Child[#, "name"] <- Chooses the #th child with the name provided
3. Child[#] <- Chooses the #th child
2 and 3 do not work, and we can't use 1 because all the fields have the same name.
I suspect if .NumChildren was working on these windows, the rest would work.
If you need more complicated example let me know.
No data to display