1. Is there anything similar to a listbox in the addon studio?

    ScrollingMessageFrame? or ScrollFrame? Which events and methods of use?

    I'd like to have a list of default messages to send to chat window.

     

     

    Is there anything similar to a listbox in the addon studio?

    ScrollingMessageFrame? or ScrollFrame? Which events and methods of use?

    I'd like to have a list of default messages to send to chat window.

     

     

    OK, i do this:

         --MyScrollFrame:SetPoint("LEFT",MainFrame); --anchors the frame to the left edge of the screen

     

    MyScrollFrame:SetFontObject("GameFontNormal"); --tells the frame to copy the styling from fontobject "GameFontNormal"

     

    MyScrollFrame:SetJustifyH("LEFT"); --tells the frame to left-justify text

     

    MyScrollFrame:SetScript("OnHyperlinkClick", function(self, ...) MyScrollFrame_OnHyperlinkShow(...) end); --tells the frame to use the default hyperlink "OnClick" action

     

    MyScrollFrame:SetFading(false); --prevents the message frame from fading the message (so that the hyperlink will stay there)

     

    MyScrollFrame:AddMessage("|cffffd000|Henchant:1111111111111|h[Frase]|h|r"); --adds an example hyperlink

     

    function MyScrollFrame_OnHyperlinkShow(reference, link, button)

    --put your event handler logic here

    SendChatMessage("¡¡Bien!!", "SAY", nil, "Chonlia");

    end

    But now, how do i can know which hyperlink is being pulsed anytime?

     

     

    The hyperlink is passed to the OnHyperlinkClick script, that's how you can tell which hyperlink is the one being clicked.  You simply look at the link argument that is passed in.  Perhaps I don't understand your question..

    My question is, if i have a lot of links:

    MyScrollFrame:AddMessage("|cffffd000|Henchant:1111111111111|h[Frase01]|h|r"); --adds an example hyperlink

    MyScrollFrame:AddMessage("|cffffd000|Henchant:1111111111111|h[Frase02]|h|r"); --adds an example hyperlink

    MyScrollFrame:AddMessage("|cffffd000|Henchant:1111111111111|h[Frase03]|h|r"); --adds an example hyperlink

    MyScrollFrame:AddMessage("|cffffd000|Henchant:1111111111111|h[Frase04]|h|r"); --adds an example hyperlink

    ...

    How do i know which one is being pulsed?

     

    THANKS!

     

    I've already answered this question for you.  You are already setting an OnHyperlinkClick scripts.  As detailed on the documentation for this script, the actual string representation of the link being clicked on is passed to the handler.  You can do something like the following to see how this works:

    local function OnHyperlinkClick(self, link, text, button)
      ChatFrame1:AddMessage(string.format("You clicked on link %s with button %s", link, button))
    end
    
    MyScrollFrame:SetScript("OnHyperlinkClick", OnHyperlinkClick)

    Obviously this won't take any action (other than to print the link to the default chat frame), but it should illustrate to you how this script handler is supposed to work.  All of thise is detailed on the documentation page linked above.