-
Posted by fuda on Sat, 07 Jul 2012 12:15:02
Hi, everytime i create an EditBox and give it a text with SetText("some Text"), the editbox seems to be empty. But I just found out that the box isnt empty, lua correctly parsed the text in it and scrolls so far away from the start that you cant see the text anymore. When I click in the editbox and press "Pos1" to jump to the start of the editbox the Text is shown. Is there a way to show the text in the editbox without having to manually go to the start of the box?
my typical declaration template:
function editbox_template(text, name, template, parent, xvalue, yvalue, width, height, multiline) local returnvalue if template == "" then template = "InputBoxTemplate" end returnvalue = CreateFrame("EditBox", name, parent, template) returnvalue:SetHeight(height) returnvalue:SetWidth(width) returnvalue:SetText(text) returnvalue:SetPoint("TOPLEFT", parent, "TOPLEFT", xvalue, yvalue) returnvalue:SetMaxLetters(255) returnvalue:SetMultiLine(multiline) returnvalue:SetAutoFocus(false) returnvalue:SetTextInsets(0, 0, 0, 0) return returnvalue end
Just found out, that I can change the position of the cursor. I added
returnvalue:SetCursorPosition(0)
to the template and it works just fine
thanks anyway ;)
-
Posted by anonyma on Sun, 07 Oct 2012 16:32:35
Another trick is to call SetText twice, the first time with an empty string end the 2nd time with the desired value.