Thread Tools Display Modes
02-23-21, 01:07 PM   #1
BloodLilly
A Murloc Raider
Join Date: Feb 2021
Posts: 4
ChatFrame1EditBox Resizing and Scrolling

Hello, I've searched this forum and the internet for a potential addon that would be what I'm looking for. However, I couldn't find anything after installing and uninstalling a lot of addons, nothing fit the bill. So I thought I would look around for code with the intention of making my own addon, however, I am not a coder. I have extremely little experience in coding and a lot of the code strings I see, don't explain what else you need to make the file work.

My intention is to make the 'ChatFrame1EditBox' adjustable in height. However I wish to do this with the parameter that it would be set to the number of lines that would fit in vertically.

For example, you would set the 'Height' to '4' and this would allow 4 lines of text to be written in the edit box in a Multi-line way. Then the section that states the Channel you are writing in, stays at the bottom left of the EditBox.

Beyond this, if a user were to time more than 4 lines after setting it to that height, the text would then scroll vertically, as opposed to it's default horizontally.

I have attached an image of what I'd like the final product to look like. I just have no idea where to start.

Code that I have tried is here

Main.lua
Code:
ChatFrame1EditBox:SetHeight(20)

ChatFrame1EditBoxLeft:SetSize(20, 20)
ChatFrame1EditBoxRight:SetSize(20, 20)
ChatFrame1EditBoxMid:SetHeight(20)

ChatFrame1EditBoxFocusLeft:SetSize(20, 20)
ChatFrame1EditBoxFocusRight:SetSize(20, 20)
ChatFrame1EditBoxFocusMid:SetHeight(20)

ChatFrame1EditBoxLanguage:SetSize(20, 20)
ChatExtender.toc
Code:
## Interface: 90002
## Title: Chatextender
## Author: BloodLilly
## Version: 1.0

Main.lua
Any help would be great. I have looked at tutorials, however, a lot of them don't state what it is I am looking for. So if you do provide a tutorial, can you please let me know which section I should pay attention to.

Edit:

I have recently found this piece of code, that allows the Edit Box to be longer and am currently seeing of I can make it taller instead of longer. But I'm still unsure how to.

Code:
function LargerChatInput_OnLoad(self)
    self:RegisterEvent("ADDON_LOADED")
end


function LargerChatInput_OnEvent(self, event, ...)
    if event == "ADDON_LOADED" then
        local addon = ...
        if addon == "LargerChatInput" then
            LargerChatInput_OnLoaded()
            self:UnregisterEvent("ADDON_LOADED")
        end
    end
end


function LargerChatInput_OnLoaded()
    hooksecurefunc(
        ChatFrame1EditBox,
        "Show",
        function()
            local left = ChatFrame1:GetLeft()
            local width = GetScreenWidth() - left - 5
            ChatFrame1EditBox:SetPoint("RIGHT", ChatFrame1, "LEFT", width, 0)
        end
    )
end
Attached Thumbnails
Click image for larger version

Name:	Concept.png
Views:	128
Size:	45.3 KB
ID:	9588  

Last edited by BloodLilly : 02-23-21 at 01:39 PM.
  Reply With Quote
02-23-21, 01:58 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Code:
ChatFrame1EditBox:SetMultiLine(true)
How it scrolls depends on how it's anchored.
It also alters some functionality like history scrolling.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-23-21 at 02:00 PM.
  Reply With Quote
02-23-21, 03:32 PM   #3
BloodLilly
A Murloc Raider
Join Date: Feb 2021
Posts: 4
How would I anchor it so that it scrolls?

I've managed to get it done to a standard using in-game commands. Attached is an image of how it looks. However, I can't seem to get it running as an addon.

Code:
/run local editBox = DEFAULT_CHAT_FRAME.editBox; editBox:ClearAllPoints(); 
editBox:SetPoint("TOPLEFT",ChatFrame1,"TOPRIGHT",0,0); 
editBox:SetPoint("BOTTOMLEFT",ChatFrame1,"BOTTOMRIGHT",0,-3); 
editBox:SetPoint("TOPLEFT",ChatFrame1,"BOTTOMLEFT",0,-93); 
editBox:SetPoint("TOPRIGHT",ChatFrame1,"BOTTOMRIGHT",23,100);
ChatFrame1EditBox:SetMultiLine(true)
I have no idea how to make this into an addon that runs when you load into the game.
It works as you put it in the chat window like that, but obviously it always resets when you reload ui
Attached Thumbnails
Click image for larger version

Name:	Edit.PNG
Views:	127
Size:	47.2 KB
ID:	9589  
  Reply With Quote
02-23-21, 04:07 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Your macro is doing 4 SetPoint calls for the editbox. Maybe something like:

Lua Code:
  1. ChatFrame1EditBox:SetMultiLine(true)
  2. ChatFrame1EditBox:ClearAllPoints()
  3. ChatFrame1EditBox:SetPoint("BOTTOMLEFT", UIParent)
  4. ChatFrame1EditBox:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMLEFT", 250, 0)

The box should resize as you type more lines. It's been a while since I played with this.

You should be able to place this in your main.lua file.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
02-23-21, 04:34 PM   #5
BloodLilly
A Murloc Raider
Join Date: Feb 2021
Posts: 4
Yeah, it's doing that because I want the editbox to be a set size, or if it expands with more lines, doesn't go beyond that size. If there are more lines after that, the lettering would scroll within the box.

I'm trying to figure out a way to have the text scroll within the set edit frame box.

EDIT:

Okay, so after reloading a few times, the Addon works... Kinda. But it's doing what you said now and is acting in the way that the more you type the bigger the box gets. However, this isn't what I want as it'll end up covering the chat box and cover previous messages, that I may be replying to. I'd like it to stay at the static fixed size and the text to scroll within it.

EDIT2:

I've added an image of what it looks like when the addon loads up. As you can see there's now a massive gap beneath the chat box and the edit box, This is also what happens when I also use your code Fizzlemizz. The only problem is, it's not really what I want it to do.

EDIT3:

I'm not quite sure why running:

Code:
/run local editBox = DEFAULT_CHAT_FRAME.editBox; editBox:ClearAllPoints(); 
editBox:SetPoint("TOPLEFT",ChatFrame1,"TOPRIGHT",0,0); 
editBox:SetPoint("BOTTOMLEFT",ChatFrame1,"BOTTOMRIGHT",0,-3); 
editBox:SetPoint("TOPLEFT",ChatFrame1,"BOTTOMLEFT",0,-93); 
editBox:SetPoint("TOPRIGHT",ChatFrame1,"BOTTOMRIGHT",23,0);
ChatFrame1EditBox:SetMultiLine(true)
In the in-game chat, causes the option I prefer (The image from my second post) and running:

Code:
ChatFrame1EditBox:ClearAllPoints(); 
ChatFrame1EditBox:SetPoint("TOPLEFT",ChatFrame1,"TOPRIGHT",0,0); 
ChatFrame1EditBox:SetPoint("BOTTOMLEFT",ChatFrame1,"BOTTOMRIGHT",0,-3); 
ChatFrame1EditBox:SetPoint("TOPLEFT",ChatFrame1,"BOTTOMLEFT",0,-93); 
ChatFrame1EditBox:SetPoint("TOPRIGHT",ChatFrame1,"BOTTOMRIGHT",23,0);
ChatFrame1EditBox:SetMultiLine(true)
Causes the outcome that I'm not to keen on (The image in the post)

EDIT4:

So I managed to get it to load the way I wanted to, now I just need to see if I can find out how to do the scrolling bit.

Code:
local frame=CreateFrame("Frame");
frame:RegisterEvent("PLAYER_LOGIN");
frame:SetScript("OnEvent",function(self,event,...)
local editBox = DEFAULT_CHAT_FRAME.editBox; editBox:ClearAllPoints()
editBox:SetPoint("TOPLEFT",ChatFrame1,"TOPRIGHT",0,0) 
editBox:SetPoint("BOTTOMLEFT",ChatFrame1,"BOTTOMRIGHT",0,-3) 
editBox:SetPoint("TOPLEFT",ChatFrame1,"BOTTOMLEFT",0,-93) 
editBox:SetPoint("TOPRIGHT",ChatFrame1,"BOTTOMRIGHT",23,0)
ChatFrame1EditBox:SetMultiLine(true)
end);
Attached Thumbnails
Click image for larger version

Name:	Edit2.PNG
Views:	112
Size:	133.3 KB
ID:	9590  

Last edited by BloodLilly : 02-23-21 at 05:58 PM.
  Reply With Quote
02-24-21, 10:06 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
I was thinking something like:
Lua Code:
  1. local frame=CreateFrame("Frame")
  2. frame:RegisterEvent("PLAYER_LOGIN")
  3. frame:SetScript("OnEvent",function(self,event,...)
  4.     local chat = DEFAULT_CHAT_FRAME
  5.     local editBox = chat.editBox
  6.     editBox:ClearAllPoints()
  7.     local x = chat:GetLeft()
  8.     local y = chat:GetBottom() - editBox:GetHeight()
  9.     editBox:SetPoint("BOTTOMLEFT", UIParent ,x ,y)
  10.     editBox:SetWidth(chat:GetWidth())
  11.     editBox:SetMultiLine(true)
  12.     local n = editBox:GetName()
  13.     _G[n.."Left"]:Hide()
  14.     _G[n.."Mid"]:Hide()
  15.     _G[n.."Right"]:Hide()
  16.     editBox.focusLeft:SetTexture(nil)
  17.     editBox.focusMid:SetTexture(nil)
  18.     editBox.focusRight:SetTexture(nil)
  19. end)
The editbox artwork doesn't adjust so I've just hidden it (some of the artwork regions might not be valid in Classic)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-24-21 at 10:22 AM.
  Reply With Quote
02-26-21, 04:29 AM   #7
BloodLilly
A Murloc Raider
Join Date: Feb 2021
Posts: 4
Thank you very much for looking into it further. That does solve the problem of it going off screen as the lettering moves up into the screen as opposed to down and off the screen. But it still ends up covering the chat. I'm still using the previous one I stated, that has the box at a set height, and it's been working really well. However, I still would like to try and get a text scrolling function that would fit into the set box.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » ChatFrame1EditBox Resizing and Scrolling

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off