Monday, April 16, 2012

ScrollingMessageFrame Clickable Links

Hi.

Anyone know how i can make links clickable in a ScrollingMessageFrame ??|||Hi Unibus. This is what you have to do:

To make links clickable in a ScrollingMessageFrame you will have to first add a message to your Message Frame somehow first:


Code:
/script MyMsgFrame:AddMessage("|cff1eff00|Hitem:3577:0:0:0:0:0:0:276308480|h[Gold Bar]|h|r");

If the above doesn't work try:


Code:
/script MyMsgFrame:AddMessage("\cff1eff00\Hitem:3577:0:0:0:0:0:0:276308480\h[Gold Bar]\h\r");



Like this we've added a link to a Gold Bar item to the message frame. Now to make the link clickable you will need to add an <OnHyperlinkClick> to the scripts of MyMsgFrame. Your XML file will look like this:


Code:
<ScrollingMessageFrame name="MyMsgFrame" ... and some other stuff>
... Anchors, Sizes and other stuff ...
<Scripts>
<OnHyperlinkClick>SetItemRef(link,text,button);</OnHyperlinkClick>
</Scripts>
</ScrollingMessageFrame>

That's it! You've got a message frame that handles links.

Klishu|||Thank you very much :D|||Hi, i'm trying to use your snippet and it doesn't works for me (scroll is empty always).

I'm using Addon Studio.

[CODE]

function btnEnviar_OnClick()

--put your event handler logic here

smfLista:AddMessage("\cff1eff00\Hitem:3577:0:0:0:0:0:0:276308480\h[Gold Bar]\h\r");

end



function smfLista_OnHyperlinkClick()

--put your event handler logic here

end



Thanks in advance.|||Hmm, doing it from within Lua, I think you need to map the functions to the events first?

No comments:

Post a Comment