Thread Tools Display Modes
05/05/14, 12:36 AM   #1
DerVagabund
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 12
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.
  Reply With Quote
05/05/14, 02:38 AM   #2
BadVolt
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 74
Originally Posted by DerVagabund View Post
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.

Last edited by BadVolt : 05/05/14 at 02:52 AM.
  Reply With Quote
05/05/14, 03:25 AM   #3
DerVagabund
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 12
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)?
  Reply With Quote
05/05/14, 04:21 AM   #4
BadVolt
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 74
Originally Posted by DerVagabund View Post
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,...
  Reply With Quote
05/05/14, 04:36 AM   #5
DerVagabund
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 12
thanks, stupid me, it's actually pretty obvious
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Controls and lua


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off