Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:HOWTO: Scroll EditBoxes to the left programatically
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== A Messier Solution == The EditBox:Insert() function scrolls the editbox to show the place where the insert took place. But ONLY after an OnUpdate event has occured following the latest :SetText() call. local function UglyScrollLeft() this:HighlightText(0,1); this:Insert(" "..strsub(this:GetText(),1,1)); this:HighlightText(0,1); this:Insert(""); this:SetScript("OnUpdate", nil); end SomeEditBox:SetText("short string"); SomeEditBox:SetScript("OnUpdate", UglyScrollLeft); The above code will cause UglyScrollLeft() to trigger exactly once after setting the new text, which in turn will select the first letter in the EditBox, and replace it with itself. This causes the EditBox to scroll to the far left. The additional highlight/insert is just to force the cursor to go flush left rather than sit at position 2, which looks annoying. :-) It ''has'' to be done after an OnUpdate has passed. Attempting to do the Insert() immediately after SetText() will have no effect. [[Category:HOWTOs|Scroll EditBoxes]]
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)