Is there a way to know if an UIObject is enabled/disabled?

I’m creating a list of elements using a loop and using the command AddListBoxRow. What i need to know is the name the objects that are added to the list.

For example, i have this:

<UIListbox name="AUGMENTS_MINUS" x=308 y=40 width=19 height=320 xPadding=0 yPadding=0 
showpartialchild=true unequalcontrols=true >
	<!-- Skill Prototype -->
	<UIPane name="AUGMENTS_MINUS_PROTO" width=PARENT_WIDTH height=26 prototype=true tupple=true
	OnLeftClick0=UIObject_Misc_ExtractData("self:","string",1,local:10)
	OnLeftClick1=UIObject_Misc_ExtractData("self:","string",2,local:11)
	OnLeftClick2=UIObject_Misc_ExecuteServerScript(gui_soulbinding_aug_alter_val,local:10,local:11)
	OnLeftClick3=UIObject_Misc_ExecuteServerScript(gui_soulbinding_refresh_aug_val) >
		<UIButton name="AUGMENT_DECREASE" width=PARENT_WIDTH height=19 >
			<UIFrame state=up		fill="gui_tom_minus_btn2_up.tga" />
			<UIFrame state=down		fill="gui_tom_minus_btn2_up.tga" />
			<UIFrame state=focused	fill="gui_tom_minus_btn2_up.tga" />
			<UIFrame state=hilited	fill="gui_tom_minus_btn2_up.tga" />
			<UIFrame state=hifocus	fill="gui_tom_minus_btn2_up.tga" />
			<UIFrame state=disabled	fill="gui_tom_minus_btn2_d.tga" />
		</UIButton>
	</UIPane>				
</UIListbox>

I need to know the names of the “AUGMENTS_MINUS_PROTO” and “AUGMENT_DECREASE” that are created using the command AddListBoxRow so later i can use the command SetGUIObjectDisabled when i do other stuff in the UI.

For reference, here is a picture of what i’m doing, what is inside the red square is being created with a loop and the command AddListBoxRow and i need to disable the + button when you don’t have more points left(the big - 0 -) or disable the - button when you haven’t spent points in a bonification.

The solution that i though is to doing it manually in the XML like this(but is what i want to avoid):

<UIButton name="AUGMENT_DECREASE_1" width=19 height=19 
OnLeftClick0=UIObject_Misc_ExecuteServerScript(gui_soulbinding_aug_alter_val,1,-1)
OnLeftClick1=UIObject_Misc_ExecuteServerScript(gui_soulbinding_refresh_aug_val) >
	<UIFrame state=up		fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=down		fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=focused	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=hilited	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=hifocus	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=disabled	fill="gui_tom_minus_btn2_d.tga" />
</UIButton>

<UIButton name="AUGMENT_DECREASE_2" y=20 width=19 height=19
OnLeftClick0=UIObject_Misc_ExecuteServerScript(gui_soulbinding_aug_alter_val,2,-1)
OnLeftClick1=UIObject_Misc_ExecuteServerScript(gui_soulbinding_refresh_aug_val) >
	<UIFrame state=up		fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=down		fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=focused	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=hilited	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=hifocus	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=disabled	fill="gui_tom_minus_btn2_d.tga" />
</UIButton>

... 
<UIButton name="AUGMENT_DECREASE_X" y=X width=19  height=19 
OnLeftClick0=UIObject_Misc_ExecuteServerScript(gui_soulbinding_aug_alter_val,X,-1)
OnLeftClick1=UIObject_Misc_ExecuteServerScript(gui_soulbinding_refresh_aug_val) >
	<UIFrame state=up		fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=down		fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=focused	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=hilited	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=hifocus	fill="gui_tom_minus_btn2_up.tga" />
	<UIFrame state=disabled	fill="gui_tom_minus_btn2_d.tga" />
</UIButton>

i’m not sure quite what yer asking, but SoZ (kinc_trade) adds listboxrows, conditionally, like so

    int i = 1;
    for (; i <= NUM_RARE_RESOURCES; ++i)
    {
        if (GetPartyStock(i, FALSE) || GetRareResourceStock(i, iLocation))
        {
            bFound = TRUE;
            AddListBoxRow(oPC,
                          GUI_MARKET_SCREEN,
                          GUI_MARKET_RARE_RES_LB,
                          GetRareResourceLabel(i),
                          GetMarketListBoxText(i, iLocation, FALSE),
                          "",
                          "1=" + IntToString(i) + ";2=" + GetRareResourcePriceString(i, iLocation),
                          "");
        }
    }

is it, that you want to add all rows, but then disable some of them?

You can put two UIButtons in the UIPane prototype, one enabled and the second disabled, and hide one of the two using the sHideUnhide parameter of AddListBoxRow

Like KevL, I am not too sure what you are asking, but could you not do a REFRESH call when toggling the option using the script like KevL says?

i.e. When the button is pushed, refresh the list according to the conditions. Even a 0.1 delay should suffice.

As I say though, this is a bit out of my comfort zone and so I may not be understanding properly.

Cheers, Lance.

@Lance_Botelle @kevL_s @CromFr
I have edited the main post to make more clear what i’m asking for.

Hi,

No, I do not know how to disable this kind of UIObject within an XML “list loop”, as the name would (in theory I guess) be the same within the XML … and I would not know how to distinguish it.

I would probably keep the code separated within the XML (each have its own section), but as you say that is quite cumbersome … and maybe not suitable at all … but that is the only way I know how to start something like that. (i.e. Like your second piece of code. It’s not too bad to copy and paste those sections … and once done, it’s done!) Some of my own XML scripts have had a lot of duplicated sections where I have not been able to do what I thought I might shorthand.

Sorry I could not be any more helpful, Lance.

At the end i used the second code that i posted, adding the button section directly into the XML.
Here is the result.

So, if I understand you correctly, the new code does allow you to disable your +/- buttons OK … yes? If so, then that sounds OK. As from your image, it looks as though you have the last two entries as the “-” enabled and everything else disabled.

So did that work as you intended now then?

Cheers, Lance.

That work like this, if you have points(where the big - 0 - is) to spend in a buff, all the plus buttons will be enabled to indicate the player that it can spend its points, if it doesn’t have more points, they will be disabled.

If you spent points in a buff, the - button of that buff row will be enabled to indicate the player that it can remove that point and use it in another buff, if a buff doesn’t have any points spended, the - button of that row will be disabled.

The big [2] is the maximum points that you can have.

With this, the player have the ability to respect those buff at will. This is part of the Pact Magic system that i’m adapting from the d&d 3.5 Tome of Magic and the Binder class.

Hi,

Sounds interesting :slight_smile: … and now it works as you hoped, yes?

Cheers, Lance.