Thread Tools Display Modes
Prev Previous Post   Next Post Next
03/10/15, 01:53 PM   #1
Dero
 
Dero's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 14
OnMouseEnter problem

Hey there.
I've got a small problem with a piece of code.

Ive got a MainObject (MainObj) and on MouseEnter a ChildObject (ChildObj) with a Button in it (ChildButton) should show up. -Works fine so far
Now on MouseExit the ChildObject should get hidden again. - Works fine too

Now The Problem:
If i MouseEnter the ChildButton to click it, the MainObj registeres a MouseExit. This leads to a spamming of Hide/Show of the ChildObject. Is there anything i can do about this, so that the ChildObject keeps being open and only hides if i MouseExit the MainObj?


Lua Code:
  1. local MainObj = WINDOW_MANAGER:CreateControl("MainObj",TLW,CT_CONTROL)
  2. MainObj:SetDimensions(200,100)
  3. MainObj:SetAnchor(TOPLEFT,GuiRoot,TOPLEFT,0,0)
  4. MainObj:SetMouseEnabled(true)
  5. MainObj:SetHandler("OnMouseEnter",function()
  6.     ChildObj:SetHidden(true)
  7. end)
  8. MainObj:SetHandler("OnMouseExit",function()
  9.     ChildObj:SetHidden(true)
  10. end)
  11.            
  12. local ChildObj = WINDOW_MANAGER:CreateControl("ChildObj",MainObj,CT_TEXTURE)
  13. ChildObj:SetDimensions(ChildObj:GetParent():GetWidth(),ChildObj:GetParent():GetHeight()/2)
  14. ChildObj:SetAnchor(BOTTOMLEFT,MainObj,BOTTOMLEFT,0,0)
  15. ChildObj:SetTexture("")
  16. ChildObj:SetDrawLayer(4)
  17. ChildObj:SetColor(0,0,0,0.8)
  18. ChildObj:SetHidden(true)
  19.            
  20. local ChildButton = WINDOW_MANAGER:CreateControl("ChildButton",ChildObj,CT_BUTTON)
  21. ChildButton:SetDimensions(ChildButton:GetParent():GetHeight()-5,ChildButton:GetParent():GetHeight()-5)
  22. ChildButton:SetAnchor(LEFT,ChildObj,LEFT,5,0)
  23. ChildButton:SetNormalTexture("")
  24. ChildButton:SetDrawLayer(4)
  25. ChildButton:SetHandler("OnClicked",function()
  26.     d("Clicked")
  27. end)
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » OnMouseEnter problem


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