here was some code I found in an AddOn a while ago, and used credit to anyone if they reconize it as there own, but it has worked nicely for me:
Code:
<ScrollFrame name="NotePadTextScrollBar" inherits="UIPanelScrollFrameTemplate" virtual="true">
<Size> <AbsDimension x="310" y="260"/> </Size>
<Anchors> <Anchor point="BOTTOMLEFT"> <Offset> <AbsDimension x="9.5" y="77"/> </Offset> </Anchor> </Anchors>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentTop" file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size> <AbsDimension x="30" y="50"/> </Size>
<Anchors> <Anchor point="TOP" relativeTo="$parentScrollBarScrollUpButton">
<Offset> <AbsDimension x="0" y="5"/> </Offset> </Anchor> </Anchors>
<TexCoords left="1" right="1" top="1" bottom="1"/>
</Texture>
<Texture file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size> <AbsDimension x="31" y="0"/> </Size>
<Anchors> <Anchor point="BOTTOM" relativeTo="$parentScrollBarScrollDownButton">
<Offset> <AbsDimension x="50" y="-2"/> </Offset> </Anchor> </Anchors>
<TexCoords left="1" right="1" top="1" bottom="1"/>
</Texture>
</Layer>
</Layers>
<ScrollChild>
<Frame enableMouse="true">
<Size> <AbsDimension x="280" y="245"/> </Size>
<Anchors> <Anchor point="TOPLEFT" relativeTo="NotePadMainFrame">
<Offset> <AbsDimension x="25" y="-185"/> </Offset> </Anchor> </Anchors>
<Frames>
<EditBox name="NotesEdit" letters="7500" multiLine="true" enableMouse="true" autoFocus="false">
<Size> <AbsDimension x="290" y="200"/> </Size>
<Anchors> <Anchor point="TOPLEFT"> <Offset> <AbsDimension x="15" y="-5"/> </Offset> </Anchor> </Anchors>
<FontString inherits="QuestFont"/>
<Scripts>
<OnShow>
self:SetFocus()
</OnShow>
<OnClick>
self:SetFocus()
</OnClick>
<OnHide>
self:ClearFocus()
</OnHide>
<OnEscapePressed>
self:ClearFocus()
</OnEscapePressed>
<OnTextChanged>
NotePad_NotesEdit_OnTextChanged(self)
</OnTextChanged>
</Scripts>
</EditBox>
</Frames>
</Frame>
</ScrollChild>
</ScrollFrame>
and in the .lua
Code:
function NotePad_NotesEdit_OnTextChanged(self)
local scrollBar = getglobal(self:GetParent():GetParent():GetName().."ScrollBar")
self:GetParent():GetParent():UpdateScrollChildRect()
local min, max = scrollBar:GetMinMaxValues()
if ( max > 0 and (self.max ~= max) and 13 > max-NotePadTextScrollBar:GetVerticalScroll()) then
self.max = max
scrollBar:SetValue(max)
end
NotePadPVars.notes[NotePadVars.buttonSelected].text = NotesEdit:GetText() -- this is where I save the text
end