1. Greetings Everyone,

    Today I started creating addons for WoW. So far so good and I've started creating a healing-addon. It works so far with displaying coloured SecureActionButtonTemplate-button for every member in your party or raid. (Only tested parties though.)

    But now I've run into a bind and I can't get the right(or any other button then the left) to work for casting spells. I searched a lot and tried a few different approaches but still no progress. Left-click works perfect and does what I want it to do, but right click fails.

    This is what I use when I create a button:

     local function createButton(frame)
            local button = CreateFrame("Button", "ButtonX", frame, "SecureActionButtonTemplate");
    
            button:SetWidth(64);
            button:SetHeight(32);
    
            button.texture = texture;
            button:SetBackdrop({    bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", 
                                    edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", 
                                    tile = true, tileSize = 16, edgeSize = 16, 
                                    insets = { left = 4, right = 3, top = 4, bottom = 3 }});
    
            button:SetBackdropColor(0.2, 0.5, 0.2, 0.9);
            --button:SetPoint("CENTER",0,0);
    
            table.insert(buttons, button);
    
            button:SetNormalFontObject("GameFontHighlight");
            local font = button:GetNormalFontObject();
            font:SetTextColor(1, 0.5, 0.25, 1.0);
            button:SetNormalFontObject(font);
    
            return button;
          end
    

    After that I edit the returned button using:

     local function _setButtons(frame,      partyData)
        local currentButtons = #buttons;
        visibleButtons = #partyData;
    
        for i, p in pairs(partyData) do
            if (i>currentButtons) then
                createButton(frame);
                if(i>1) then
                    buttons[i]:SetPoint("LEFT",buttons[i-1],"RIGHT",3, 0);
                else
                    buttons[i]:SetPoint("LEFT",frame, 10, 0);           
                end
            end
    
            buttons[i]:SetText(p.name);
    
            buttons[i]:SetAttribute("unit", p.uid);
            buttons[i]:SetAttribute("type1", "spell");
            buttons[i]:SetAttribute("spell1", "Flash of Light");
            buttons[i]:SetAttribute("type2", "spell");
            buttons[i]:SetAttribute("spell2", "Holy Light");
    
            buttons[i]:Show();
        end
    
    
        if(visibleButtons<currentButtons) then
            for i=visibleButtons+1, currentButtons do
                buttons[i]:Hide();
            end
        end
    
        _resize();
     end
    

    It recycles buttons for when the party increases, decreases and increases again. That is the only point in the code where I use SetAttribute.

    I would be ever so grateful if anybody could help me with this! (I'm playing on OS X, using the steelseries Cataclysm mouse. with a Draenei Paladin.)

  2. Try adding an appropriate call to RegisterForClicks somewhere.

  3. Perfect that was exactly what was missing! Thank you so very much! (Now everything works perfectly!)

    Never read about it, but still...sorry I didn't know.

  4. There is a chapter that does exactly what you're doing in case you want to look at that and see explanations of everything. I'm glad you got it working!

  5. Thank you! Can't read the book yet though, it has been ordered but takes a while to deliver. (7-14 days.)