Thread Tools Display Modes
07-10-09, 05:24 PM   #1
Aurorablade
A Deviate Faerie Dragon
 
Aurorablade's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 16
LibDBIcon show/hiding

(EDIT:I have fixed the issue, but gonna leave it here anyway)

this is something incredibly stupid i am sure, but i am having trouble show/hiding my icon.

I have it registered like this in my OnInitialize

Code:
if not icon:IsRegistered("RollCrafterCombatFeed") then
    print("hit");
        RC_MISC.Icon = {};
		local rccf = ldb:GetDataObjectByName("RollCrafterCombatFeed");
		icon:Register("RollCrafterCombatFeed", rccf, RC_MISC.Icon);
          
           if RC_MISC["MMI"] == 1 then
          icon:Hide("RollCrafterCombatFeed");
        else
         icon:Show("RollCrafterCombatFeed");
           end

	end
now my icon is there is just not responding to show/hide commands, even if i do it manually with wow lua

I guess i will include my choppy broker code (Note i refer to all my code negatively, bad habit) just incase the problem lies there
Code:
local combatFeed = ldb:NewDataObject("RollCrafterCombatFeed", {
	type = "launcher",--"data source",
	icon = "Interface\\Icons\\INV_Misc_Dice_01",
	text = "RollCraft",
	value = "",
	label = "Sheet:",
	--[[OnClick = function(clickedframe, button)
    if button == "RightButton" then
    local Welmenu = GHM_NewFrame(RC_WelMenu)  
				  Welmenu.ClearAll()
				  Welmenu:Show();
    else
    core:ABHS();
       
    end]]
    
	--end,
	}
)



function RC_setFeed()

if RC_Plrydata["CurrentSheet"] ~= nil then
combatFeed.vlaue = tostring(RC_Plrydata["CurrentSheet"]);
else
combatFeed.value = "No Sheet";
end

end

sheetcount = 0;
local function RCHandlerFunc(cell, arg, event)

        local text = arg;
        if sheetcount <= 1 or RC_Plrydata["CurrentSheet"] == text then
        D(L["sheetselerr"])
        return;
        end
        core:UpdateCS(text);
        RC_setFeed()
             
     end


function hideTooltip()
	if MouseIsOver(tooltip) then return end
	tooltip:SetScript("OnLeave", nil)
	tooltip:Hide()
	QTC:Release(tooltip)
	tooltip = nil
	
end



function combatFeed:OnClick(button)
        if button == "RightButton" then
                if IsAltKeyDown() then
                        ABHS();
                else
                        --makeTooltip();
                        tooltip = QTC:Acquire("cfTip", 5,"CENTER")
	tooltip:Clear()
	tooltip:SmartAnchorTo(self)
	tooltip:SetScript("OnLeave", hideTooltip)
	tooltip:Hide()
	tooltip:Show()
	tooltip:SetCallback("OnMouseDown", RCHandlerFunc)
	
	
	 for k,v in pairs(RC_Classdata) do
	 local y, x = tooltip:AddLine()
	 y, x = tooltip:SetCell(y, x, k, function() return k end, "CENTER")
	 sheetcount = sheetcount +1;
	 --print(sheetcount);
	  end

       end
     else
         if IsAltKeyDown() then
            local Optmenu = GHM_NewFrame(RC_OptMenu)  
           Optmenu.ClearAll()
                
         Optmenu.ForceLabel("bar_scale",RC_MISC["abScale"]);
         --Optmenu.ForceLabel("rattk",RC_MISC["emAttk"]);
         Optmenu.ForceLabel("MMI",RC_MISC["MMI"]);            
         Optmenu.ForceLabel("pbroad",RC_MISC["pBcast"]);
         Optmenu.ForceLabel("abvert",RC_MISC["vert"]);         
         
             Optmenu:Show();
         else
     local Welmenu = GHM_NewFrame(RC_WelMenu)  
		  Welmenu.ClearAll()
	  Welmenu:Show();
	   end
      end
end
local LQT = LibStub('LibQTip-1.0');

function combatFeed.OnEnter(self)
local csheet
if RC_Plrydata["CurrentSheet"] ~= nil then
csheet = RC_Plrydata["CurrentSheet"];
else
csheet = "No Sheet";
end

 local tip = LQT:Acquire("ABTIP", 3, "LEFT")
           self.tip = tip 
           tip:SetScript("OnLeave", nil)
           tip:AddHeader("|cFF0000FFRollCraft|r")
           tip:AddLine("|cFF00FF00"..L["Your Current Sheet is:"].."|cFFFFFF00"..csheet.."|r")
          tip:AddLine("Left Click for options")
          tip:AddLine("Right Click for Class Select")
         tip:AddLine("Alt-Right Click to show hide skill bar")
         tip:AddLine("Alt-Left Click for config")
         tip:SmartAnchorTo(self)
            tip:Show()            
end


function combatFeed.OnLeave(self)
self.tip:Hide();
LQT:Release(self.tip)
     self.tip = nil
end

Last edited by Aurorablade : 07-10-09 at 05:46 PM.
  Reply With Quote
07-10-09, 06:14 PM   #2
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
where is your code that actually shows and hides the icon?

currently i only some of it in your OnInit function but there it is uttery uneccesary since LibDBIcon saves it states to the table you pass it and as long as that table is part of you SavedVariable table it will keep track of the sho/hid state by itself.

i also do not see anywhere where you change RC_MISC["MMI"] as such it will always be nil and your icon will always show on init

show your entire code please cause right now it seams to be only fragments and we can only guess what else is there or not
  Reply With Quote
07-10-09, 06:46 PM   #3
Aurorablade
A Deviate Faerie Dragon
 
Aurorablade's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 16
yeah i fixed it by forcing the states with the DB along with my Show and Hide

However i could not delete the post so i just made an edit saying i fixed it.
  Reply With Quote
07-10-09, 08:20 PM   #4
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
It's better to not delete a thread as it can be useful to others.
__________________
Never be satisfied with satisfactory.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LibDBIcon show/hiding


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