-
Posted by macarthor on Fri, 19 Aug 2011 09:27:34
Dears, The following codes are aimed to accomplish such task: mouseover the first button and show the whole action bar:
local OnEnterScript = [[ if trigger == "OnMouseOver" then control:ChildUpdate("show", nil) toggledOn = true end ]] local OnLeaveScript = [[ if trigger == "OnMouseOver" then control:ChildUpdate("hide", nil) toggledOn = false end ]] local OnUpdateScript = [[ counter = counter + elapsed if self:IsUnderMouse(true) then counter = 0 elseif counter > 0.4 then counter = 0 control:ChildUpdate("hide", nil) toggledOn = false end ]] local OnShowScript = "self:Show()" local OnHideScript = "self:Hide()" function ZActionBar_LinkButton(bar, button) bar.header:WrapScript(button, "OnClick", OnClickScript) bar.header:WrapScript(button, "OnEnter", OnEnterScript) bar.header:WrapScript(button, "OnLeave", OnLeaveScript) if button:GetID() > 1 then button:SetAttribute("_childupdate-hide", OnHideScript) end end function ZActionBar_EnableButton(button, isAlwaysOn) button:SetAttribute("_childupdate-show", OnShowScript) if isAlwaysOn or button:GetID() == 1 then button:Show() end end
When I mouseover the first button, through the commented prints, I can see ChileUpdate() function is called. But the hiden buttons do not show.
-
Posted by jnwhiteh on Fri, 19 Aug 2011 09:34:08
I'm not sure, to be honest. There's so much missing code and context, I don't see anything immediately wrong.
-
Posted by macarthor on Fri, 19 Aug 2011 10:01:05
I'm not sure, to be honest. There's so much missing code and context, I don't see anything immediately wrong.
Would you plz give some sample snippet? or any other project that implements such feature.
-
Posted by macarthor on Fri, 19 Aug 2011 10:10:44
I'm not sure, to be honest. There's so much missing code and context, I don't see anything immediately wrong.
The 2nd parameter of control:ChildUpdate is "message", what's that exactly?
-
Posted by jnwhiteh on Fri, 19 Aug 2011 10:19:30
I'm not sure, to be honest. There's so much missing code and context, I don't see anything immediately wrong.
Would you plz give some sample snippet? or any other project that implements such feature.
I'm sorry, I don't have a special purpose snippet like this.
I'm not sure, to be honest. There's so much missing code and context, I don't see anything immediately wrong.
The 2nd parameter of control:ChildUpdate is "message", what's that exactly?
From the field guide to secure handlers documentation for ChildUpdate():
"Iterates over all of the protected children of the header and checks for the attribute
_childupdate-<scriptid>
, if that is nil orscriptid
is nil then it falls back to_childupdate
. If the attribute has a string value then it is processed as a secure snippet and invoked with the parametersself
,scriptid
andmessage
, whereself
is the child, andscriptid
andmessage
are the values from the call."It's an argument that you can use to make the same snippet/function do different things depending on the message you send in.
-
Posted by macarthor on Fri, 19 Aug 2011 11:06:43
Many thx. It seems that TotemTimers implements the feature. I'll look in to it.