Download
(7 Kb)
Download
Updated: 05/28/20 03:14 PM
Pictures
File Info
Compatibility:
Greymoor (6.0.5)
Updated:05/28/20 03:14 PM
Created:10/31/14 02:56 PM
Monthly downloads:3,654
Total downloads:483,410
Favorites:368
MD5:
LibMsgWin  Popular! (More than 5000 hits)
Version: 1.0 r11
by: sirinsidiator [More]
What does it do?
Allows the easy creation/use of a simple message window that mimics the look of the regular chat window, is scrollable, handles link clicks, and slaps an easy access AddText(..), ChangeFade(..), & ClearText() function on it. It also has a label at the top you can assign a value to if you wish to label your window. The fade is only for the text, the background does not fade, but still useful if you want to hide the background & set the text to fade out.

I wrote this just to use for debugging messages & other random things and thought someone else might be interested in having a message window they can add messages to...that they don't have to write themselves...so here it is.

Function...yeah there is only one
Lua Code:
  1. -- Requires a unique control name for your chat window
  2. -- (optional) Text for the heading label - if left nil the label control will not be created
  3. -- (optional) FadeDelay & FadeTime - if left nil text will not fade
  4. -- Returns a TopLevelControl (which contains your chat window)
  5. libmw:CreateMsgWindow(string UniqueName, string LabelText, integer FadeDelay, integer FadeTime)

For ease of use, the TopLevelControl returned by libmw:CreateMsgWindow(...) has the following functions:
Lua Code:
  1. -- Add a message to your chat window, with colors:
  2. myMsgWindow:AddText("Heres a chat message", Red, Green, Blue)
  3.  
  4. -- Change the text fadeDelay & fadeDuration:
  5. myMsgWindow:ChangeTextFade(integer FadeDelay, integer FadeDuration)
  6.  
  7. -- Change the window fadeDelay & fadeDuration:
  8. myMsgWindow:ChangeWinFade(_FadeDelay, _FadeTime)
  9.  
  10. -- Clear all of the text from the textBuffer (clears the text in the window)
  11. myMsgWindow:ClearText()


Instructions
Add LibMsgWin-1.0 as a dependency in your addon.txt file:
Lua Code:
  1. ## DependsOn: LibMsgWin-1.0

Add this line to the top of every code file you want to use it in:
Lua Code:
  1. local LIBMW = LibMsgWin
Start using it.

Examples of Use:
Lua Code:
  1. -- Don't forget to grab the library at the top of every code file your trying to use this in:    
  2. local LIBMW = LibMsgWin
  3.  
  4. -- After a 25 second delay the text will start to fade.
  5. -- Once it starts fading it will take 4 seconds to completely fade
  6. local myMsgWindow = LIBMW:CreateMsgWindow("UberAddonChatWindow", "Window Header Label", 25, 4)
  7.  
  8. -- To prevent the text from fading Use 0, 0 for the fade delay & duration
  9. local myMsgWindow = LIBMW:CreateMsgWindow("UberAddonChatWindow", "Window Header Label", 0, 0)
  10.  
  11. -- Or just leave them nil
  12. local myMsgWindow = LIBMW:CreateMsgWindow("UberAddonChatWindow", "Window Header Label")
  13.  
  14. -- Then call one of the controls built in functions:
  15. myMsgWindow:AddText("Heres a chat message in red", 1, 0, 0)
  16. myMsgWindow:ChangeTextFade(0, 0)
  17. myMsgWindow:ChangeWinFade(2000, 3000)
  18. myMsgWindow:ClearText()

The code can be found on github: https://github.com/sirinsidiator/ESO-LibMsgWin
Version 1.0 r11 ~ sirinsidiator
- Added LICENSE and put the code on github

Version 1.0 r10 ~ sirinsidiator
- Updated for Harrowstorm and Greymoor
- Made LibStub usage optional and removed embedded copy

Version 1.0 r9 ~ sirinsidiator
- Updated for Elsweyr
- Added global variable LibMsgWin for access without LibStub

Version 1.0_R8 -- Requested Feature

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:
Lua Code:
  1. function tlw:ChangeWinFade(_FadeDelay, _FadeTime)
Accessible from the control returned to you when you create the window. All times are in milliseconds.

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:
Lua Code:
  1. function tlw:ChangeTextFade(_FadeDelay, _FadeTime)
All times are in milliseconds.

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
Lua Code:
  1. function tlw:AddText(_Message, _Red, _Green, _Blue)
or OnMouseEnter for the text buffer control (the window)

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:
  1. local myDebugWin = LIBMW:CreateMsgWindow("JunkItDebugWindow", "JunkIt Debug Window", 4000, 3000)
  2. --[[ So they are stored here:
  3.    myDebugWin.fadeDelayWindow
  4.    myDebugWin.fadeTimeWindow
  5.  
  6.    myDebugWin.fadeDelayTextLines
  7.    myDebugWin.fadeTimeTextLines
  8. --]]
Version 1.0_R7 -- Oops

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_R6 -- Requested Change

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:
  1. -- changed this:
  2.     elseif numHistoryLines == 200 then
  3. -- to this:
  4.     elseif numHistoryLines == self:GetNamedChild("Buffer"):GetMaxHistoryLines() then
Version 1.0_R5 -- Requested Feature

Text In Color: Added parameters to the AddText function to allow you to pass through colors for the text:
Lua Code:
  1. function tlw:AddText(Message, Red, Green, Blue)

Version 1.0_R4 --
Reverse Scroll: Apparently the window scrolled in the wrong direction. It scrolled the opposite direction of the original chat window. It has been fixed.
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.
Version 1.0_R3 --
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.
Lua Code:
  1. libmw:CreateMsgWindow(_UniqueName, _LabelText, _FadeDelay, _FadeTime)


Version 1.0_R2B --
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.
Archived Files (10)
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


Post A Reply Comment Options
Unread 04/19/20, 09:39 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1566
File comments: 1120
Uploads: 41
Re: soo...

Originally Posted by Aneova
The Error is FTC? because it's the only addon i have that uses LibMsgWin. If I have it enabled i can no longer do anything with my chat window, error dialog pops up if i try to touch the chat window at all while it's on.
Yes. There is simply no possible way how the library could cause this problem. It has only one functionality and that is to create a new window, which has nothing to do with chat.
The only reason why you believe it is due to this library is because it is a required dependency for FTC and when you disable the library, you disable FTC too which of course makes the error go away!
Last edited by sirinsidiator : 04/19/20 at 09:39 AM.
Report comment to moderator  
Reply With Quote
Unread 04/19/20, 08:58 AM  
Aneova

Forum posts: 0
File comments: 3
Uploads: 0
soo...

The Error is FTC? because it's the only addon i have that uses LibMsgWin. If I have it enabled i can no longer do anything with my chat window, error dialog pops up if i try to touch the chat window at all while it's on.
Report comment to moderator  
Reply With Quote
Unread 02/24/20, 02:03 PM  
Sedare

Forum posts: 0
File comments: 18
Uploads: 0
makes sense that it would be FTC b/c it does create chat windows for like combat log stuff.
Report comment to moderator  
Reply With Quote
Unread 02/24/20, 01:57 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1566
File comments: 1120
Uploads: 41
Originally Posted by Sedare
Originally Posted by sirinsidiator
Originally Posted by Sedare
Really need this updated. I think FTC is causing the issue, but here's the error:

EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: operator - is not supported for nil - number
stack traceback:
EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: in function 'ZO_ChatSystem:Maximize'
|caaaaaa<Locals> self = [table:1]{isAgentChatActive = F, currentChannel = 2, ignoreTextEntryChangedEvent = F, numUnreadMails = 44, lastValidChannel = 0, minContainerWidth = 300, suppressSave = F, maxContainerWidth = 550, allowMultipleContainers = F, minContainerHeight = 170, currentNumNotifications = 1, isMinimized = T, currentTarget = "@Jack.Savage", loaded = T, maxContainerHeight = 380}, i = 1, container = [table:2]{fadeInReferences = 0, primary = T, hiddenTabStartIndex = 2, minAlpha = 0, allowSettingsSave = T, id = 1, maxAlpha = 1} </Locals>|r
(tail call): ?
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2001: in function 'SharedChatSystem:StartTextEntry'
|caaaaaa<Locals> self = [table:1], currentSceneName = "worldMap" </Locals>|r
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2365: in function 'StartChatInput'
ZO_ChatWindowTextEntryEditBox_MouseDown:4: in function '(main chunk)'
|caaaaaa<Locals> self = ud, button = 1, ctrl = F, alt = F, shift = F, command = F </Locals>|r
Are you sure you got the right comment section? This error doesn't seem related to LibMsgWin and it works fine for me?


All i know is that if i deactivate it, it deactivates FTC and the bug goes away.
It's more likely FTC is causing the problem then. This library has nothing to do with chat functions, so I don't see how it would even cause an error like that.
Report comment to moderator  
Reply With Quote
Unread 02/24/20, 01:32 PM  
Sedare

Forum posts: 0
File comments: 18
Uploads: 0
Originally Posted by sirinsidiator
Originally Posted by Sedare
Really need this updated. I think FTC is causing the issue, but here's the error:

EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: operator - is not supported for nil - number
stack traceback:
EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: in function 'ZO_ChatSystem:Maximize'
|caaaaaa<Locals> self = [table:1]{isAgentChatActive = F, currentChannel = 2, ignoreTextEntryChangedEvent = F, numUnreadMails = 44, lastValidChannel = 0, minContainerWidth = 300, suppressSave = F, maxContainerWidth = 550, allowMultipleContainers = F, minContainerHeight = 170, currentNumNotifications = 1, isMinimized = T, currentTarget = "@Jack.Savage", loaded = T, maxContainerHeight = 380}, i = 1, container = [table:2]{fadeInReferences = 0, primary = T, hiddenTabStartIndex = 2, minAlpha = 0, allowSettingsSave = T, id = 1, maxAlpha = 1} </Locals>|r
(tail call): ?
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2001: in function 'SharedChatSystem:StartTextEntry'
|caaaaaa<Locals> self = [table:1], currentSceneName = "worldMap" </Locals>|r
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2365: in function 'StartChatInput'
ZO_ChatWindowTextEntryEditBox_MouseDown:4: in function '(main chunk)'
|caaaaaa<Locals> self = ud, button = 1, ctrl = F, alt = F, shift = F, command = F </Locals>|r
Are you sure you got the right comment section? This error doesn't seem related to LibMsgWin and it works fine for me?


All i know is that if i deactivate it, it deactivates FTC and the bug goes away.
Report comment to moderator  
Reply With Quote
Unread 02/24/20, 01:26 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1566
File comments: 1120
Uploads: 41
Originally Posted by Sedare
Really need this updated. I think FTC is causing the issue, but here's the error:

EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: operator - is not supported for nil - number
stack traceback:
EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: in function 'ZO_ChatSystem:Maximize'
|caaaaaa<Locals> self = [table:1]{isAgentChatActive = F, currentChannel = 2, ignoreTextEntryChangedEvent = F, numUnreadMails = 44, lastValidChannel = 0, minContainerWidth = 300, suppressSave = F, maxContainerWidth = 550, allowMultipleContainers = F, minContainerHeight = 170, currentNumNotifications = 1, isMinimized = T, currentTarget = "@Jack.Savage", loaded = T, maxContainerHeight = 380}, i = 1, container = [table:2]{fadeInReferences = 0, primary = T, hiddenTabStartIndex = 2, minAlpha = 0, allowSettingsSave = T, id = 1, maxAlpha = 1} </Locals>|r
(tail call): ?
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2001: in function 'SharedChatSystem:StartTextEntry'
|caaaaaa<Locals> self = [table:1], currentSceneName = "worldMap" </Locals>|r
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2365: in function 'StartChatInput'
ZO_ChatWindowTextEntryEditBox_MouseDown:4: in function '(main chunk)'
|caaaaaa<Locals> self = ud, button = 1, ctrl = F, alt = F, shift = F, command = F </Locals>|r
Are you sure you got the right comment section? This error doesn't seem related to LibMsgWin and it works fine for me?
Report comment to moderator  
Reply With Quote
Unread 02/24/20, 01:22 PM  
Sedare

Forum posts: 0
File comments: 18
Uploads: 0
Really need this updated. I think FTC is causing the issue, but here's the error:

EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: operator - is not supported for nil - number
stack traceback:
EsoUI/Ingame/ChatSystem/Keyboard/KeyboardChatSystem.lua:370: in function 'ZO_ChatSystem:Maximize'
|caaaaaa<Locals> self = [table:1]{isAgentChatActive = F, currentChannel = 2, ignoreTextEntryChangedEvent = F, numUnreadMails = 44, lastValidChannel = 0, minContainerWidth = 300, suppressSave = F, maxContainerWidth = 550, allowMultipleContainers = F, minContainerHeight = 170, currentNumNotifications = 1, isMinimized = T, currentTarget = "@Jack.Savage", loaded = T, maxContainerHeight = 380}, i = 1, container = [table:2]{fadeInReferences = 0, primary = T, hiddenTabStartIndex = 2, minAlpha = 0, allowSettingsSave = T, id = 1, maxAlpha = 1} </Locals>|r
(tail call): ?
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2001: in function 'SharedChatSystem:StartTextEntry'
|caaaaaa<Locals> self = [table:1], currentSceneName = "worldMap" </Locals>|r
EsoUI/Ingame/ChatSystem/SharedChatSystem.lua:2365: in function 'StartChatInput'
ZO_ChatWindowTextEntryEditBox_MouseDown:4: in function '(main chunk)'
|caaaaaa<Locals> self = ud, button = 1, ctrl = F, alt = F, shift = F, command = F </Locals>|r
Report comment to moderator  
Reply With Quote
Unread 05/20/19, 09:21 PM  
eventHandler
AddOn Author - Click to view AddOns

Forum posts: 12
File comments: 58
Uploads: 4
I don't know why I never saw this before, because I thought I'd gone through all the libraries. I'll probably start using this in my addon to standardize my output...
Report comment to moderator  
Reply With Quote
Unread 05/20/19, 02:10 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1566
File comments: 1120
Uploads: 41
Originally Posted by Marazota
you need fix typo bcz minion going crazy xD
Better now?
Report comment to moderator  
Reply With Quote
Unread 05/20/19, 02:04 PM  
Marazota
AddOn Author - Click to view AddOns

Forum posts: 257
File comments: 1517
Uploads: 2




you need fix typo bcz minion going crazy xD
Report comment to moderator  
Reply With Quote
Unread 07/31/15, 12:29 PM  
merlight
AddOn Author - Click to view AddOns

Forum posts: 671
File comments: 213
Uploads: 12
As per request
## ReverseDependsOn: merUndefinedGlobalsCatcher
Report comment to moderator  
Reply With Quote
Unread 03/28/15, 11:50 PM  
circonian
AddOn Author - Click to view AddOns

Forum posts: 613
File comments: 804
Uploads: 27
Re: Hello

Originally Posted by awesomebilly
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
Thats fine, if you have any questions about it just let me know.
Report comment to moderator  
Reply With Quote
Unread 03/28/15, 10:04 PM  
awesomebilly
AddOn Author - Click to view AddOns

Forum posts: 23
File comments: 230
Uploads: 8
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
Report comment to moderator  
Reply With Quote
Unread 11/26/14, 08:11 AM  
merlight
AddOn Author - Click to view AddOns

Forum posts: 671
File comments: 213
Uploads: 12
Originally Posted by circonian
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:
  1. window.buffer:AddMessage(message, r, g, b, category)
The buffer doesn't know anything about chat system, it's the other way round - chat system uses chat category as the colorId.

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)
Report comment to moderator  
Reply With Quote
Unread 11/23/14, 08:28 PM  
circonian
AddOn Author - Click to view AddOns

Forum posts: 613
File comments: 804
Uploads: 27
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.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: