Partial Fix: Classic Compatibility with -4.0 #11


  • Suggestion
  • Implemented
Closed
  • DahkCeles created this issue Mar 27, 2021

    Classic compatibility was apparently dropped in LibUIDropDownMenu-4.0 versus earlier versions (-2.0).

     

    If you wish to restore compatibility, the following changes will get you part of the way there...

     

     

    local function creatre_DropDownList(name, parent)

      -- leave everything up to the OnShow script...


      f:SetScript("OnShow", function(self)
        -- leave everything currently in the OnShow script...

        -- at the bottom of the OnShow script, insert the following
        if (not UIDropDownMenu_HandleGlobalMouseEvent) then
          self.hideTimer = self.hideTimer or C_Timer.NewTicker(L_UIDROPDOWNMENU_SHOW_TIME, function()
            if (GetMouseFocus() ~= self) then
              self:Hide();
            end
          end)
        end
      end)


      f:SetScript("OnHide", function(self)
        -- leave everything currently in the OnShow script...

       

        -- at the bottom of the OnHide script, insert the following
        if (self.hideTimer) then
          self.hideTimer:Cancel();
          self.hideTimer = nil;
        end
      end)

      return f
    end

     

    -- hooking UIDropDownMenu_HandleGlobalMouseEvent
    do
      if lib and UIDropDownMenu_HandleGlobalMouseEvent then
        hooksecurefunc("UIDropDownMenu_HandleGlobalMouseEvent", function(button, event)
          lib:UIDropDownMenu_HandleGlobalMouseEvent(button, event)
        end)
      end
    end

  • DahkCeles added a tag Suggestion Mar 27, 2021
  • arithmandar posted a comment May 18, 2021

    Hi DahkCeles, there was some problem with curseforge so my early release (v4.01) was never sent out. I did implemented some codes to handle the global mouse event, although not exactly the same way like your implementations (I didn't add those codes in OnShow / OnHide). Could you help to check if those are still suggested in the latest revision?

  • DahkCeles posted a comment May 19, 2021

    I don't actually use the Lib any more in my own addon, so I'll have to wait until one of the other addons updates to test for this specific issue.

     

     

    Meanwhile, I glanced over the code in 4.03 here on curse and found the following change you might want to consider.  This will simplify the differences between Classic Era, Burning Crusade Classic and Shadowlands.

     

     

    Line 136

     

    	-- ColorSwatch
    	local fcw
    --	if WoWClassic then
    --		fcw = CreateFrame("Button", name.."ColorSwatch", f)
    --	else
    --		fcw = CreateFrame("Button", name.."ColorSwatch", f, BackdropTemplateMixin and "ColorSwatchTemplate" or nil)
    --	end
    	fcw = CreateFrame("Button", name.."ColorSwatch", f, BackdropTemplateMixin and DropDownMenuButtonMixin and "BackdropTemplate,ColorSwatchTemplate" or BackdropTemplateMixin and "BackdropTemplate" or nil);
    	fcw:SetPoint("RIGHT", f, -6, 0)
    	fcw:Hide()
    --	if WoWClassic then
    	if not DropDownMenuButtonMixin then
    		fcw:SetSize(16, 16)
    		fcw.SwatchBg = fcw:CreateTexture(name.."ColorSwatchSwatchBg", "BACKGROUND")
    		fcw.SwatchBg:SetVertexColor(1, 1, 1)
    		fcw.SwatchBg:SetWidth(14)
    		fcw.SwatchBg:SetHeight(14)
    		fcw.SwatchBg:SetPoint("CENTER", fcw, 0, 0)
    		local button1NormalTexture = fcw:CreateTexture(name.."ColorSwatchNormalTexture")
    		button1NormalTexture:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch")
    		button1NormalTexture:SetAllPoints()
    		fcw:SetNormalTexture(button1NormalTexture)
    	end
    

    Edited May 19, 2021
  • arithmandar posted a comment Jun 14, 2021

     Implemented

  • arithmandar added a tag Implemented Jun 14, 2021
  • arithmandar posted a comment Jun 14, 2021

    I use the StartCounting / StopCounting mechanism which was on early version of WoW to implement the show/hide features. Looks to be working more smoothly.

     

  • arithmandar closed issue Jul 17, 2022

To post a comment, please login or register a new account.