-
Posted by chonli on Sat, 13 Sep 2008 11:04:44
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.
-
Posted by chonli on Sat, 13 Sep 2008 11:04:44
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.
-
Posted by chonli on Sun, 14 Sep 2008 04:38:08
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? -
Posted by jnwhiteh on Sun, 14 Sep 2008 04:51:10
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..
-
Posted by chonli on Tue, 16 Sep 2008 12:56:58
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!
-
Posted by jnwhiteh on Tue, 16 Sep 2008 16:27:24
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.