View Single Post
02-18-18, 02:35 AM   #26
Coldkil
A Cliff Giant
 
Coldkil's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 70
triple post, but i didn't wnat to open another thread for this.

I'm doing the actionbars and everything was fie until one point - now i have the first and second actionbar that have the same spells replicated. Obviously there's something wrong.

Here's what's happening (and it started after a while and not immediately)


code here:
--- main bar
Code:
  -- reusing Blizzard buttons and move in the right place. whole 12 button bar

  --create the frame to hold the buttons
  local bar = CreateFrame("Frame","cBar1",UIParent, "SecureHandlerStateTemplate")
  bar:SetPoint("BOTTOMRIGHT",Minimap,"BOTTOMLEFT",-12,3)
  bar:SetFrameLevel(2)
  bar:SetSize(246,36)

  -- cycle through the buttons
  for i=1, 12 do
    local button = _G["ActionButton"..i]
	button:SetParent(bar)
    button:SetSize(36,36)
    button:ClearAllPoints()
    if i == 1 then
	  button:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT")
	elseif i == 7 then  
	  button:SetPoint("BOTTOMLEFT", _G["ActionButton1"], "TOPLEFT", 0, 6)
    else
      local previous = _G["ActionButton"..i-1]
	  button:SetPoint("LEFT", previous, "RIGHT", 6, 0)
    end
  end

  --show/hide the frame on a given state driver
  RegisterStateDriver(MainMenuBarArtFrame, "visibility", "[petbattle][overridebar][vehicleui] hide; show")
  
  -- vehicle exit button
  local veb = CreateFrame("BUTTON", nil, bar, "SecureHandlerClickTemplate")
  veb:SetParent(bar)
  veb:SetPoint("RIGHT", bar, "LEFT", -5, 0)
  veb:SetSize(28, 28)
  veb:RegisterForClicks("AnyUp")
  veb:SetNormalTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up")
  veb:SetPushedTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down")
  veb:SetHighlightTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Down")
  veb:SetScript("OnClick", function(self) VehicleExit() end)
  RegisterStateDriver(veb, "visibility", "[target=vehicle,exists] show;hide")
-- second bar:
Code:
  -- second bar on mouseover above the main bar

  --create the frame to hold the buttons, plus mouseover script
  local bar = CreateFrame("Frame","cBar2",UIParent, "SecureHandlerStateTemplate")
  bar:SetPoint("TOPRIGHT",Minimap,"TOPLEFT",-2,4)
  bar:SetFrameLevel(2)
  bar:SetSize(264, 94)
  bar:SetBackdrop({
	edgeFile = "Interface\\AddOns\\cMedia\\border",
	edgeSize = 4,
	insets = {left = 4,right = 4,top = 4,bottom = 4}
  })
  bar:SetBackdropBorderColor(0,0,0)
  --bar:SetAlpha(0)
  --bar:SetScript("OnEnter", function() bar:SetAlpha(1) end)
  --bar:SetScript("OnLeave", function() bar:SetAlpha(0) end)
  
  -- texture to match main bar
  texture = bar:CreateTexture("cBar2Top")
  texture:SetTexture("Interface\\MainMenuBar\\UI-MainMenuBar-Dwarf",1)
  texture:SetTexCoord(0, 1.0, 0.58203125, 0.75)
  texture:SetPoint("TOPLEFT", bar, "TOPLEFT", 4,-4)
  texture:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -4, 47)
  texture2 = bar:CreateTexture("cBar2Bottom")
  texture2:SetTexture("Interface\\MainMenuBar\\UI-MainMenuBar-Dwarf",1)
  texture2:SetTexCoord(0, 1.0, 0.58203125, 0.75)
  texture2:SetPoint("TOPLEFT", bar, "TOPLEFT", 4,-46)
  texture2:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -4, 4)


  for i= 1, 12 do
    local button = _G["MultiBarBottomLeftButton"..i]
	button:SetParent(bar)
    button:SetSize(36,36)
    button:ClearAllPoints()
    if i == 1 then
		button:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT", 7, 7)
	elseif i == 7 then  
		button:SetPoint("BOTTOMLEFT", _G["MultiBarBottomLeftButton1"], "TOPLEFT", 0, 6)
	else
		local previous = _G["MultiBarBottomLeftButton"..i-1]
		button:SetPoint("LEFT", previous, "RIGHT", 6, 0)
	end
	--mouseover scripts
	--button:SetScript("OnEnter",function() bar:SetAlpha(1) end)
	--button:SetScript("Onleave",function() bar:SetAlpha(0) end)
  end
 
  --show/hide the frame on a given state driver
  RegisterStateDriver(MultiBarBottomLeft, "visibility", "[petbattle][overridebar][vehicleui] hide; show")
  Reply With Quote