EQ2Interface

EQ2Interface (https://www.eq2interface.com/forums/index.php)
-   UI Developer Discussion (https://www.eq2interface.com/forums/forumdisplay.php?f=3)
-   -   Nesting Issues (https://www.eq2interface.com/forums/showthread.php?t=16425)

TalTal 05-01-2012 02:09 PM

Nesting Issues
 
I had a bit of free time and wantted to try out an idea but I am having issues. Here it is:

Window in Custom:


<Page AlwaysOnTop="true" eq2usescomwndcontrols="true" Location="100,100" MinimumSize="535,518" Name="Settings" PackLocation="nfn,bottom" ScrollExtent="535,518" Size="535,518" UserMovable="true" UserResizable="false" >
<Page Location="-2,15" MinimumSize="535,498" Name="TabPages" PackLocation="nfn,bottom" ScrollExtent="535,498" Size="535,498" Visible="true">
<Page Location="0,0" MinimumSize="535,498" Name="Bar_Settings" PackLocation="left,top" ScrollExtent="535,498" Size="535,498" Visible="false">
<Button Location="235,466" MaximumSize="16384,26" Size="32,32" Name="SetButton" OnPress="
Parent.Parent.Parent.Parent.Parent.MainHUD.Clock.SetDisplay.Text='Test'
">Update</Button>
</Page>
</Page>
</Page>


Window in MainHUD (the clock):

<Page AlwaysOnBottom="true" eq2usescomwndcontrols="true" Location="0,748" MinimumSize="800,50" Name="Clock" PackLocation="nfn,bottom" ScrollExtent="800,50" Size="800,50" UserMovable="true" UserResizable="true">
<Button Name="SetDisplay" Size="32,32" OnPress="
Parent.Parent.Parent.Custom.Settings.TabPages.Bar_Settings.SetButton.Text='Press Me'
">Tester</Button>
</Page>

The onpress event of the button 'SetDisplay' will change the text of the button 'SetButton' from in-game.

The onpress event of the button 'SetButton' will NOT change the text of the button 'SetDisplay' from in-game.

I'm guessing that it is a nesting issue but I cannot track it down. Any tips?

Silat

keezyrick 05-02-2012 09:32 AM

Looks to me like you have one too many Parent nests in your command. You going outside the container by the time you call MainHUD.

<Button Location="235,466" MaximumSize="16384,26" Size="32,32" Name="SetButton" OnPress="
Parent.Parent.Parent.Parent.Parent.MainHUD.Clock.SetDisplay.Text='Test'
">Update</Button>

TalTal 05-02-2012 10:42 AM

That one moves it to hud from custom so that you can then go back to MainHUD. At any rate trying it with 2-6 Parent.Parent's does not seem to work. I think the game does not like accessing mainhud from custom or that there is some trick to it that I do not know.

Silat

EQAditu 05-02-2012 11:24 AM

This will probably sound crazy as I can barely remember it myself... but there are multiple versions of the UI the game has.

There's a "memory" version and a "file" version. The reason I call it those is that the "file" version has the XML reference structure of the files, while the "memory" version is the one the game actively uses but does not have the same structure for referencing.

File structure:
Code:

<root>
    <MainHUD>
        <Clock/>
    </MainHUD>
    <Custom>
        <Settings/>
    </Custom>
</root>

Memory structure:
Code:

<root>  <!-- Some called it _HUD -->
    <Clock/>  <!-- ALL windows are merged into one XML node -->
    <Settings/>
</root>

The memory structure is what you should always use as otherwise you'll have odd side effects. Similar to how if you use /show_window with the wrong capitalization. "A window" will show up, but it won't work correctly.

Drumstix42 05-02-2012 04:03 PM

EQAditu is right, and gm9 had stated it a few times in the past in a few topics.

You can figure out it's called "_HUD" by echoing some ".Name" parameters to the chat window or to a ui text elelment.
Basically if you do it in UIBuilder one way, you just need to remove a ".Parent.MainHUD" from your code for it to work normally in-game.

You CAN still use Parent.MainHUD in some cases, or for other parts of the UI, but it will only seem to modify the code if that window is never shown automatically, or ever receives a /show_window command. This command seems almost like an initialization code, as in it adds it to the "_HUD" root.

For the reason above, is why you must use the /show_window command once per "new" custom window you add, before you try to access it via UI code.
In my UI, I use tons of customs windows to save locations/sizes as settings, and I have to make sure I use the /show_window command for all of them.


All times are GMT -5. The time now is 12:20 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI