ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Controls and lua (https://www.esoui.com/forums/showthread.php?t=1374)

DerVagabund 05/05/14 12:36 AM

Controls and lua
 
Hello,

I've a few questions which I could not solve myself.
  1. Is there a way to enable/disable user controls in a frame while it is shown? E.g., I click on a button and a textbox is enabled, I click again and it is disabled?
  2. Can I show/hide a user control on click?
  3. For both above cases, do I have to udpate the parent container where the user controls reside that this is taken into account?
  4. How can I tell a user control to update while it is shown without closing and re-opening the window?

Hm, well, that are my current question :)

Thanks for any answers.

BadVolt 05/05/14 02:38 AM

Quote:

Originally Posted by DerVagabund (Post 6958)
Hello,

I've a few questions which I could not solve myself.
  1. Is there a way to enable/disable user controls in a frame while it is shown? E.g., I click on a button and a textbox is enabled, I click again and it is disabled?
  2. Can I show/hide a user control on click?
  3. For both above cases, do I have to udpate the parent container where the user controls reside that this is taken into account?
  4. How can I tell a user control to update while it is shown without closing and re-opening the window?

Hm, well, that are my current question :)

Thanks for any answers.

It is possible, but you shouldn't use too much LUA inside XML. It's always better to create special function that will be triggered on event fired.

1. I think it should work.
<OnClicked>
YourRef:SetMouseEnabled(not (YourRef:IsMouseEnabled()))
</OnClicked>

2.
<OnClicked>
YourRef:SetHidden(not (YourRef:IsHidden()))
</OnClicked>

3. This will help preform any method with your container's parent. If you really need it.
<OnClicked>
(self:GetPatent()):*yourmethod*
</OnClicked>

4. Just update your container as usual. You don't have to hide it.

DerVagabund 05/05/14 03:25 AM

Hm, thanks for the reply, that answers most of my questions :)

But about the update, I create my own scrolllist and then I update all containing controls. But when I do this, it seems that the items in the control are not updated correctly. When I close the window and reopen it, then all changes are applied. Do I need to reload the scrolllist or is there a function to tell it to refresh its contents?

edit: ah, how to make a top level window capture key presses (again, in pure lua, not xml - in xml I found a way)?

BadVolt 05/05/14 04:21 AM

Quote:

Originally Posted by DerVagabund (Post 6966)
Hm, thanks for the reply, that answers most of my questions :)

But about the update, I create my own scrolllist and then I update all containing controls. But when I do this, it seems that the items in the control are not updated correctly. When I close the window and reopen it, then all changes are applied. Do I need to reload the scrolllist or is there a function to tell it to refresh its contents?

edit: ah, how to make a top level window capture key presses (again, in pure lua, not xml - in xml I found a way)?

Hm. Don't know about scrolls. Never used them :)

Same as for all others.
Lua Code:
  1. SomeRef:SetHandler("OnKeyUp" , function(self, key, ctrl, alt, shift, command)
  2. -- your action
  3. end)

Events:
OnKeyDown
OnKeyUp

Arguments:
self, key, ctrl, alt, shift, command,...

DerVagabund 05/05/14 04:36 AM

thanks, stupid me, it's actually pretty obvious :rolleyes:


All times are GMT -6. The time now is 03:56 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI