EQ2Interface

EQ2Interface (https://www.eq2interface.com/forums/index.php)
-   XML Modification Help & Info (https://www.eq2interface.com/forums/forumdisplay.php?f=22)
-   -   Onset varible (https://www.eq2interface.com/forums/showthread.php?t=15532)

Draven_Caine 03-27-2011 04:09 PM

Onset varible
 
I have an option in my collections window that when you hit the add button it adds the collectible to the collection (normal) and than auto closes the window.

Now instead of having this on the add button all the time, i wish to add a checkbox at the bottom of the window that sets this variable.

OnSet=Parent.Parent.CollectionTemplate.AddButton.OnPress='hide_window Journals.JournalsQuest'
UnSet=Parent.Parent.CollectionTemplate.AddButton.OnPress='' (blank so it removes the behavior)

This is all done thru the default window so the hierarchy and such is normal other than the on added checkbox i added at the bottom, which is at the same location as the other 2 checkboxes.

Now my issues is the checkbox doesnt change the OnPress varible when in-game. What am I doing wrong here?

Thanks,
Draven

Drumstix42 03-27-2011 04:16 PM

I've found that modifying default buttons within the UI is a bad idea. Sometimes it'll work, and sometimes it won't. Other times you'll get unexpected results.
I like to think that these buttons already have "OnPress" events and adding another is sometimes a bad idea.

What I do is clone whatever "default UI" button it is I'm working with and call it another name and place it ontop of that button. I put my code I need to use in that button and make the final step of the code to trigger the "default" button. In this case it would be the add button.

With the code you're trying to do, I suggest just making 2 different buttons that get toggled visibly over the button. One button would trigger the Add button and auto close, the other would just trigger the Add button. You're check box could control which one is showing.

Cheers.

Draven_Caine 03-27-2011 04:20 PM

I was thinking of that also but two problems come to mind
  • What variable should i use on the new buttons?
  • Adding the OnPress to the default button works fine, its just doesn't change dynamically in-game, it just changes each time i load the UI.

I am working on a diffrent part of the UI right now, i'll try the 2 button idea in a minute or so and report back sir.

Thanks,
Draven

Draven_Caine 03-27-2011 04:24 PM

I changed the name of the button and it doesn't work now. First off its always visible and when you press the button the collectible item isn't added to the collection.

Draven

Draven_Caine 03-27-2011 04:48 PM

OK re-reading your reply i think i miss understood you.

{AutoClose} <-- Add the auto close visible code to effect this one?
Make the checkbox effect this buttons visible?
How do I make this button "fire" the default button?

{Default add}

I hope i understood it ok this time around, sorry :(

Thanks,
Draven

gm9 03-27-2011 04:57 PM

It isn't working for two reasons. One is what Drumstix said, the other is that you are only modifying the template row, not the actual row. So make sure that you create that custom button within the template. Also your checkbox will not affect anything, have your code within the new button check the state of the checkbox instead.

Draven_Caine 03-27-2011 05:06 PM

OK i think you both have went right over my poor head, sadly.

Maybe oyu can post some sample code so I can follow you a bit better?

Draven

TalTal 03-27-2011 05:46 PM

<SNIP>
Coding not smart when tired. lol.

Silat

Draven_Caine 03-27-2011 06:03 PM

lol @TalTal

Drumstix42 03-27-2011 08:41 PM

Don't actually modify the normal Add button. I wanted you to "clone" it IE make one that mimics it and that's where your extra code goes. This code then triggers the Add button

[Check box] toggles which button # is visible

{YourCloned button #1} Press it, do some stuff, press the Add button, close window
{YourCloned button #2} Press it, do some stuff, press the Add button
{Add button} gets pressed by the cloned button

Draven_Caine 03-27-2011 09:58 PM

Quote:

Originally Posted by Drumstix42 (Post 96453)
Don't actually modify the normal Add button. I wanted you to "clone" it IE make one that mimics it and that's where your extra code goes. This code then triggers the Add button

[Check box] toggles which button # is visible

{YourCloned button #1} Press it, do some stuff, press the Add button, close window
{YourCloned button #2} Press it, do some stuff, press the Add button
{Add button} gets pressed by the cloned button

OK, i got that much but the issue I am having is how to make it do the stuff.
how to make my button press the default button?

I know how to make it visible or not and how to close the window.

Thanks both of you for bareing with me on this :)
Draven

Drumstix42 03-27-2011 11:21 PM

Reference it correctly and do a AddButton.press=true
... or whatever it's called in the XML

Draven_Caine 03-27-2011 11:53 PM

Yeah, the press=true was my mistake, but i am having the issue of with the checkbox the buttons aren't changing visibility in-game, in the uibuilder they are.

gm9 03-28-2011 08:51 AM

Quote:

Originally Posted by Draven_Caine (Post 96456)
Yeah, the press=true was my mistake, but i am having the issue of with the checkbox the buttons aren't changing visibility in-game, in the uibuilder they are.

I already explained cause and solution...

Draven_Caine 03-28-2011 10:08 AM

Quote:

Originally Posted by gm9 (Post 96446)
It isn't working for two reasons. One is what Drumstix said, the other is that you are only modifying the template row, not the actual row. So make sure that you create that custom button within the template. Also your checkbox will not affect anything, have your code within the new button check the state of the checkbox instead.

It might explain cause and effect to the knowing eye but not for me /sigh nvm Ill figure it out for myself.

Landiin 03-28-2011 10:22 AM

What he is saying is...

Read the state of your checkbox (checkbox.checked) via your fake add button. You can't insert data into the correct row where the add button resides b/c the game copies the template XML (the row XML code) and adds rows as needed at runtime(when the window is created in _HUD) from the copied template XML. Thus your check box is only changing the data in the template row not the real row that your add button is really in. It does this before the window is shown so using the OnShow of the main window is useless in this case.

Draven_Caine 03-28-2011 12:40 PM

Quote:

Originally Posted by Draven_Caine (Post 96447)
OK i think you both have went right over my poor head, sadly.

Maybe oyu can post some sample code so I can follow you a bit better?

Draven

You guys keep saying what cant be done and what should be done very vaguely, Can one of you post some sample code so I can follow what your saying .... please

Like where ot put the code in my "custom button"?
How to check the state of my check box from my "custom button"?

Drumstix42 03-28-2011 12:53 PM

I wasn't even thinking of which Add button this was until now. So yeah, as they already said, you can't reference the Add button or the cloned buttons from the Checkbox.

So, leave your checkbox as is, and don't put any special code in it.
What you'd probably have to do, is use a OnHoverIn code to show your fake Add button or not.

The code would look something like this:
OnHoverIn="Visible=(Parent.Parent.YourCheckBox.checked == true)"

That way if the checkbox wasn't checked, the fake button would hide, and the normal Add button would then be pressable. You'd have to put this "OnHoverIn" code directly on the FakeAdd button I'm thinkin though, so it would get copied through the whole template.

Draven_Caine 03-28-2011 01:20 PM

Quote:

Originally Posted by Drumstix42 (Post 96465)
I wasn't even thinking of which Add button this was until now. So yeah, as they already said, you can't reference the Add button or the cloned buttons from the Checkbox.

So, leave your checkbox as is, and don't put any special code in it.
What you'd probably have to do, is use a OnHoverIn code to show your fake Add button or not.

The code would look something like this:
OnHoverIn="Visible=(Parent.Parent.YourCheckBox.checked == true)"

That way if the checkbox wasn't checked, the fake button would hide, and the normal Add button would then be pressable. You'd have to put this "OnHoverIn" code directly on the FakeAdd button I'm thinkin though, so it would get copied through the whole template.

Awsome, almost got it.

My button has HoverIn=Visible=(Parent.Parent.FilterPage.AutoClose.checked == true)

But the issue now is if the checkbox (Named AutoClose) keeps the button visible if the check box is checked as needed, and if i uncheck the box it disappears on mouse-over, but if i re-check the box and mouse-over the button again the custom button doesn't re-appear.

The funny thing about this code is its not even for me, its for a friend that wanted this option added to her UI lol.

Drumstix42 03-28-2011 02:40 PM

Ah, right, once it hides itself, it wouldn't be able to trigger an OnHover again since OnHover only works for visible things. You're best bet is to use a page that sits on top of the button, and always visible, but has nothing in it AbsorbsInput=false and has no style. That page can have the OnHoverIn code to tell the fake button to appear or not. That way it always gets triggered.

Sorry for the scatterbrain-ness.

gm9 03-28-2011 07:36 PM

OnHoverIn is messy. The usual way is to create two custom buttons, one to overlay the default button, the second one is invisible. Invisible one gets your hide_window code in it's OnActivate event, followed by an activated=false. The first button activated the second button depending on the state of the checkbox, so Parent.SecondButton.Activated=Parent.Parent.YourCheckbox.checked.

Drumstix42 03-29-2011 12:43 AM

Yeah, that works too.

Draven_Caine 03-29-2011 02:10 PM

1 Attachment(s)
Thanks for all the help everyone, but I couldn't get either Drumstix's or GM9's options to work, but in the good news i figured out a way other than those ways ...

I added 2 buttons to the template file both "new" buttons press the default add button, one of the custom buttons also /hide_window also. The reason I added the 2nd custom button instead of using the default add button was because my custom "add and close" button was always visible and the default "add" button wasn't. SO I added a 2nd custom button so it was always visible like my first custom button but behaves like the default add button.

The words overflow a bit on the first button for right now because this is just a temporary fix until i recode / re-skin this window in the future.

Thanks again for all the help, i just couldn't get it to work.
Draven


All times are GMT -5. The time now is 04:39 AM.

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