1. Hello, everyone.

    I wanna have items insertable into an editbox in my addon just like you shift-click them into chat. Unfortunately that doesn't look like default behavior, so pls tell me how to do this?

    Hello, everyone.

    I wanna have items insertable into an editbox in my addon just like you shift-click them into chat. Unfortunately that doesn't look like default behavior, so pls tell me how to do this?

    The following code is taken from Clique and does precisely this.

       -- Hook the container buttons
        local containerFunc = function(button)
            if IsShiftKeyDown() and CliqueCustomArg1 then
                if CliqueCustomArg1:HasFocus() then
                    CliqueCustomArg1:Insert(GetContainerItemLink(button:GetParent():GetID(), button:GetID()))
                elseif CliqueCustomArg2:HasFocus() then
                    CliqueCustomArg2:Insert(GetContainerItemLink(button:GetParent():GetID(), button:GetID()))
                elseif CliqueCustomArg3:HasFocus() then
                    CliqueCustomArg3:Insert(GetContainerItemLink(button:GetParent():GetID(), button:GetID()))
                elseif CliqueCustomArg4:HasFocus() then
                    CliqueCustomArg4:Insert(GetContainerItemLink(button:GetParent():GetID(), button:GetID()))
                elseif CliqueCustomArg5:HasFocus() then
                    CliqueCustomArg5:Insert(GetContainerItemLink(button:GetParent():GetID(), button:GetID()))
                end
            end
        end
    
        hooksecurefunc("ContainerFrameItemButton_OnModifiedClick", containerFunc)
    
        -- Hook the bank buttons
        local bankFunc = function(button)
            if IsShiftKeyDown() and CliqueCustomArg1 then
                if CliqueCustomArg1:HasFocus() then
                    CliqueCustomArg1:Insert(GetContainerItemLink(BANK_CONTAINER, button:GetID()))
                elseif CliqueCustomArg2:HasFocus() then
                    CliqueCustomArg2:Insert(GetContainerItemLink(BANK_CONTAINER, button:GetID()))
                elseif CliqueCustomArg3:HasFocus() then
                    CliqueCustomArg3:Insert(GetContainerItemLink(BANK_CONTAINER, button:GetID()))
                elseif CliqueCustomArg4:HasFocus() then
                    CliqueCustomArg4:Insert(GetContainerItemLink(BANK_CONTAINER, button:GetID()))
                elseif CliqueCustomArg5:HasFocus() then
                    CliqueCustomArg5:Insert(GetContainerItemLink(BANK_CONTAINER, button:GetID()))
                end
            end
        end
    
        hooksecurefunc("BankFrameItemButtonGeneric_OnModifiedClick", bankFunc)
    
        -- Hook the paper doll frame buttons
        local dollFunc = function(button)
            if IsShiftKeyDown() and CliqueCustomArg1 then
                if CliqueCustomArg1:HasFocus() then
                    CliqueCustomArg1:Insert(GetInventoryItemLink("player", button:GetID()))
                elseif CliqueCustomArg2:HasFocus() then
                    CliqueCustomArg2:Insert(GetInventoryItemLink("player", button:GetID()))
                elseif CliqueCustomArg3:HasFocus() then
                    CliqueCustomArg3:Insert(GetInventoryItemLink("player", button:GetID()))
                elseif CliqueCustomArg4:HasFocus() then
                    CliqueCustomArg4:Insert(GetInventoryItemLink("player", button:GetID()))
                elseif CliqueCustomArg5:HasFocus() then
                    CliqueCustomArg5:Insert(GetInventoryItemLink("player", button:GetID()))
                end
            end
        end
        hooksecurefunc("PaperDollItemSlotButton_OnModifiedClick", dollFunc)     

    Found a better solution (for my case):

    Old_ChatEdit_InsertLink = ChatEdit_InsertLink

    ChatEdit_InsertLink = function(text)

        return MyAddon_Edit_InsertLink(text) or Old_ChatEdit_InsertLink(text)

    end

    ChatEdit_InsertLink is not a secure function, so just changing it works quite well. I wonder if using hooksecurefunction would be better.

    I wonder if using hooksecurefunction would be better.

    Oh, I can answer my own question! Obviously there is no difference provided that no other addon changes hooked function.

    That's not entirely true.. taint is somethign you really need to worry about.  A secure hook would be better here, it will allow you to define your own behavior without needing to alter the default UI.  That's precisely why I use the method I use.

    Have the same problem. Due to my pure knowlege about links, could smb help? Just an example of function to hook a link and paste to editbox. I mean how to catch shift+click on item, spell, another hyperlink etc. and copy a hyperlink.

    Have the same problem. Due to my pure knowlege about links, could smb help? Just an example of function to hook a link and paste to editbox. I mean how to catch shift+click on item, spell, another hyperlink etc. and copy a hyperlink.

    We've already provided that in this thread.. haven't we?

    Sorry. I've misunderstand smth. What is "CliqueCustomArg1" in that funcs? And where i can see the list of secure functions?

    It's code from Clique.

    What exactly are you trying to accomplish. Rather than posting in a closed thread, I would suggest creating a new thread saying exactly what you'd like to do.