Go to Page... |
Compatibility: | Greymoor (6.0.5) |
Updated: | 05/28/20 03:14 PM |
Created: | 10/31/14 02:56 PM |
Monthly downloads: | 2,332 |
Total downloads: | 504,198 |
Favorites: | 369 |
MD5: |
-- Requires a unique control name for your chat window -- (optional) Text for the heading label - if left nil the label control will not be created -- (optional) FadeDelay & FadeTime - if left nil text will not fade -- Returns a TopLevelControl (which contains your chat window) libmw:CreateMsgWindow(string UniqueName, string LabelText, integer FadeDelay, integer FadeTime)
-- Add a message to your chat window, with colors: myMsgWindow:AddText("Heres a chat message", Red, Green, Blue) -- Change the text fadeDelay & fadeDuration: myMsgWindow:ChangeTextFade(integer FadeDelay, integer FadeDuration) -- Change the window fadeDelay & fadeDuration: myMsgWindow:ChangeWinFade(_FadeDelay, _FadeTime) -- Clear all of the text from the textBuffer (clears the text in the window) myMsgWindow:ClearText()
## DependsOn: LibMsgWin-1.0
local LIBMW = LibMsgWin
-- Don't forget to grab the library at the top of every code file your trying to use this in: local LIBMW = LibMsgWin -- After a 25 second delay the text will start to fade. -- Once it starts fading it will take 4 seconds to completely fade local myMsgWindow = LIBMW:CreateMsgWindow("UberAddonChatWindow", "Window Header Label", 25, 4) -- To prevent the text from fading Use 0, 0 for the fade delay & duration local myMsgWindow = LIBMW:CreateMsgWindow("UberAddonChatWindow", "Window Header Label", 0, 0) -- Or just leave them nil local myMsgWindow = LIBMW:CreateMsgWindow("UberAddonChatWindow", "Window Header Label") -- Then call one of the controls built in functions: myMsgWindow:AddText("Heres a chat message in red", 1, 0, 0) myMsgWindow:ChangeTextFade(0, 0) myMsgWindow:ChangeWinFade(2000, 3000) myMsgWindow:ClearText()
Version 1.0_R7 -- Oops
Window Fade Added the ability to fade the window. It defaults to the same FadeDelay & FadeTime you were passing in for the text fade (so their the same) and will also default to 0 (no fade) if no values are passed in. But if you want them to have different fadeDelay/fadeTime's you can change it by using:
Accessible from the control returned to you when you create the window. All times are in milliseconds.Lua Code:
function tlw:ChangeWinFade(_FadeDelay, _FadeTime)
Text Fade Change Due to the addition of the window fading option/function I thought it would be best to clarify the function used to change the text fade so I changed its name, it is now called:
All times are in milliseconds.Lua Code:
function tlw:ChangeTextFade(_FadeDelay, _FadeTime)
Fade In Not an animation, but the window & text will both automatically reset to an alpha value of 1:
When text is added to the window using
or OnMouseEnter for the text buffer control (the window)Lua Code:
function tlw:AddText(_Message, _Red, _Green, _Blue)
The window & text will both begin their fadeDelay then fadeTime as soon as the text has been entered or OnMouseExit of the text buffer control (window).
Time Storage In case you need to access the fadeDelay/fadeTime for the window or text I stored it in the control that is returned to you when you create the window for easy access:
Lua Code:
local myDebugWin = LIBMW:CreateMsgWindow("JunkItDebugWindow", "JunkIt Debug Window", 4000, 3000) --[[ So they are stored here: myDebugWin.fadeDelayWindow myDebugWin.fadeTimeWindow myDebugWin.fadeDelayTextLines myDebugWin.fadeTimeTextLines --]]
Version 1.0_R6 -- Requested Change
A Default Color Would Be Nice: I forgot to set a default color if one was not passed in, caught it as soon as I uploaded R6.
Version 1.0_R5 -- Requested Feature
Code Change: Small code change for how the slider starts to move when the buffer is full & text is added to the window. Changed it from a hard coded 200 (the default number of MaxHistoryLines) to grabbing the current maxHistoryLines which will allow users to change the default number of MaxHistoryLines if they wish.
Lua Code:
-- changed this: elseif numHistoryLines == 200 then -- to this: elseif numHistoryLines == self:GetNamedChild("Buffer"):GetMaxHistoryLines() then
Text In Color: Added parameters to the AddText function to allow you to pass through colors for the text:
Lua Code:
function tlw:AddText(Message, Red, Green, Blue)
Reverse Scroll: Apparently the window scrolled in the wrong direction. It scrolled the opposite direction of the original chat window. It has been fixed.Version 1.0_R3 --
Scroll Visiblity: Fixed the slider so it now only becomes visible when there are enough lines of text to scroll off of the screen.
Known Issue: If you resize the window and there becomes enough space for all lines of text the slider does not hide itself until the user scrolls the window or another line of text is added to the window (instead of hiding itself immediately upon resizing). I can not get the OnResizeStop handler to work, will fix as soon as I figure it out, or find a way around using OnResizeStop.
Window Heading Label: I Added a label control to the window that can be used to add text to the top of the window.
WARNING: Due to adding the window heading label I needed to add an extra parameter to the function. It is the second parameter and the fade parameters are now third & fourth.
libmw:CreateMsgWindow(_UniqueName, _LabelText, _FadeDelay, _FadeTime)
Added LibStub: I forgot to include LibStub in the previous update zip file. It is now included, no other changes.Version 1.0_R2 --
cntrl:ClearText(): Added an easily accessible ClearText() function to clear the text from the buffer, so you don't have to mess with getting the buffer control. You can just call it on the main control returned by CreateMsgWindow(..), Yeah I'm that lazy.
File Name |
Version |
Size |
Uploader |
Date |
1.0 r10 |
3kB |
sirinsidiator |
04/24/20 02:56 PM |
|
1.0 r9 |
4kB |
sirinsidiator |
05/20/19 11:18 AM |
|
1.0_R8 |
3kB |
circonian |
12/29/14 06:24 AM |
|
1.0_R7 |
4kB |
circonian |
11/23/14 08:14 PM |
|
1.0_R6 |
4kB |
circonian |
11/23/14 08:05 PM |
|
1.0_R4 |
4kB |
circonian |
11/22/14 11:40 PM |
|
1.0_R3 |
3kB |
circonian |
11/22/14 12:36 AM |
|
1.0_R2B |
3kB |
circonian |
11/03/14 10:30 PM |
|
1.0_R2 |
2kB |
circonian |
11/03/14 07:18 AM |
|
1.0_R1 |
2kB |
10/31/14 02:56 PM |
Comment Options |
merlight |
View Public Profile |
Send a private message to merlight |
Find More Posts by merlight |
Add merlight to Your Buddy List |
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
11/22/14, 11:42 PM | |
|
Scroll Direction
I fixed it.
|
|
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
11/23/14, 07:56 AM | |
|
Thanks. In the 3rd point I meant the mouse wheel and slider were connected - both scrolling the text in the wrong direction - I turn the wheel "down", slider moved down, and text moved down, while I expected the text to move up Scrolling works ok now (edit: again my stupid with the slider, sry)
* You can store children as members in the window control, so you don't have to call GetNamedChild all the time: Lua Code:
* In local function AdjustSlider(self): Lua Code:
* Can you please add tail args to AddText, and pass them down to AddMessage? I'd like to set the default text color (without markup) Lua Code:
Last edited by merlight : 11/23/14 at 08:01 AM.
|
|
merlight |
View Public Profile |
Send a private message to merlight |
Send email to merlight |
Find More Posts by merlight |
Add merlight to Your Buddy List |
11/23/14, 09:41 AM | |
Thanks for this!
Very useful I'm using it in some of my addons |
|
|
Khrill |
View Public Profile |
Send a private message to Khrill |
Send email to Khrill |
Find More Posts by Khrill |
Add Khrill to Your Buddy List |
11/23/14, 02:37 PM | |||
|
Because if you want a "default" color for all text it would be better off going somewhere else. I could add some kind of SetColor() to the tlw like I did with the AddText. |
||
|
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
11/23/14, 02:53 PM | ||
|
|
|
|
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
11/23/14, 07:42 PM | ||
|
Are you just wanting arguments for: r,g,b? Lua Code:
Are you also literally wanting variable arguments for some reason? Lua Code:
P.S. I'm leaving soon for a week, but will keep an eye on posts when I can. I went ahead and added the color parameters so you could have it to use now. If you have any other code suggestions or feature change requests just let me know & I'll get to it when I can or when I get back in a week. Oh and since you like helping Your a bit more knowledgeable than me you got any ideas about this known problem: The only thing that I know that does not work is that if you resize the window to make room for all of the lines of text the scroll bar does not dissappear. I was trying to check whether or not the scroll bar should be visible as a user resizes the window like the real chat window does, but I could not get the "OnResizeStop" to work for some reason...see here: OnReszieStop Post Any ideas? I don't doubt Garkins knowledge, but I'de really hate to have to rewrite it all to XML just to get it to work.
Last edited by circonian : 11/23/14 at 07:56 PM.
|
|
|
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
11/23/14, 08:11 PM | ||
|
I suggested varargs because it's short and generic, and might even be faster (if I'm not mistaken, "..." is one push on stack while "r, g, b, ..." are four). |
|
|
merlight |
View Public Profile |
Send a private message to merlight |
Send email to merlight |
Find More Posts by merlight |
Add merlight to Your Buddy List |
11/23/14, 08:19 PM | |||
|
ColorId 5th Parameter? I thought that was for a category (like guild, yell, tell, exc...) for the main chat window. Is it different for a user created buffer or am I looking at the wrong thing in the eso files? Lua Code:
|
||
|
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
11/23/14, 08:28 PM | |
|
Out of Town
I am signing off & will be out of town for about a week for thanksgiving. I will try to check in when I can to see if there are any problems or questions.
|
|
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
11/26/14, 08:11 AM | ||
|
h3. TextBufferControl * SetColorById(*integer* _colorId_, *number* _r_, *number* _g_, *number* _b_) When you change chat category color in game settings, two things happen: - CHAT_SYSTEM:SetChannelCategoryColor calls SetColorById on each buffer to change the color of existing messages - SetChatCategoryColor sets the color for future messages (r, g, b passed to AddMessage) |
|
|
merlight |
View Public Profile |
Send a private message to merlight |
Send email to merlight |
Find More Posts by merlight |
Add merlight to Your Buddy List |
03/28/15, 10:04 PM | |
|
Hello
You've done a great job with this addon.
I'm looking to replace Unicorn & List in a few of my addons. Would you mind if I follow your code as an example? I need to re-write a few pieces to fit my needs.. but I wanted to check if it's ok with you? Thanks, AB |
|
awesomebilly |
View Public Profile |
Send a private message to awesomebilly |
Send email to awesomebilly |
Find More Posts by awesomebilly |
Add awesomebilly to Your Buddy List |
03/28/15, 11:50 PM | ||
|
Re: Hello
|
|
|
circonian |
View Public Profile |
Send a private message to circonian |
Send email to circonian |
Find More Posts by circonian |
Add circonian to Your Buddy List |
07/31/15, 12:29 PM | |
|
As per request
## ReverseDependsOn: merUndefinedGlobalsCatcher |
|
merlight |
View Public Profile |
Send a private message to merlight |
Send email to merlight |
Find More Posts by merlight |
Add merlight to Your Buddy List |