WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Create a single-line MessageFrame? (https://www.wowinterface.com/forums/showthread.php?t=57557)

Zax 09-29-19 05:19 AM

Create a single-line MessageFrame? (SOLVED)
 
Hello,

I can't figure how to create a single-line MessageFrame, is order to display a string during a certain time, and then fade out.

Code:

local myMsgFrame = CreateFrame("MessageFrame", "myAddon_myMsgFrame", UIParent)
myMsgFrame:SetSize(200, 20)
myMsgFrame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 80, 200);
-------------- texture
local texture = myMsgFrame:CreateTexture(nil,"BACKGROUND")
texture:SetAllPoints(true)
texture:SetColorTexture(0, 0, 0, 0.6)
myMsgFrame.texture = texture
-------------- text
myMsgFrame.text = myMsgFrame:CreateFontString(nil, nil, "GameFontNormal")
myMsgFrame.text:SetPoint("topleft", 4, 1)
... ?


I would like to use it in my scripts with:
Code:

myMsgFrame:AddMessage(string, r, g, b, nil, holdTime)
Thank you.

Seerah 09-29-19 11:54 AM

I don't see you telling it which font to use.

Zax 09-29-19 12:41 PM

Oh, yes, I know several lines are missing. That's why I wrote a question mark, because I read some online documentations but didn't understand what commands should I use.

To precisely answer your question,
Code:

"Fonts\\FRIZQT__.TTF", 11, "OUTLINE, MONOCHROME"
would be fine :)

SDPhantom 09-29-19 02:28 PM

You could use the existing UIErrorsFrame:AddExternalErrorMessage(message).

Zax 09-30-19 03:30 AM

Quote:

Originally Posted by SDPhantom (Post 334046)
You could use the existing UIErrorsFrame:AddExternalErrorMessage(message).

Interesting to display errors, but I would like to display different kinds of texts, not only warnings (for example, something like "Data sent" or "Updated"...)

Zax 09-30-19 09:30 AM

OK, I just discovered API C_Timer.After, so I'm now able to erase a "standard" frame's text after duration.


All times are GMT -6. The time now is 09:41 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI