Thread Tools Display Modes
09-12-10, 08:56 AM   #1
tayedaen
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 13
EditBox: cursorOffset and cursoHeight

I got some strange errors in the beta concerning new properties of the EditBox:
cursorOffset and cursorHeight.

It seems the Blizzard OnLoad code does not set two new properties properly.
At least I got nil errors because they were not set.

Does anybody have an information about that?


Original code (getting nil errors with it):
Code:
              <EditBox name="$parentEdit" enableMouse="true" multiLine="true" AutoFocus="false">
                <Size>
                  <AbsDimension x="264" y="281" />
                </Size>
                <Scripts>
                    <OnUpdate>
                        ScrollingEdit_OnUpdate(self,0);
                    </OnUpdate>
                    <OnTextChanged>
                        ScrollingEdit_OnTextChanged(self);
                    </OnTextChanged>
New code (working):
Code:
              <EditBox name="$parentEdit" enableMouse="true" multiLine="true" AutoFocus="false">
                <Size>
                  <AbsDimension x="264" y="281" />
                </Size>
                <Scripts>
                    <OnUpdate>
                        self.cursorOffset = self.cursorOffset or 0;
                        self.cursorHeight = self.cursorHeight or 0;
                        ScrollingEdit_OnUpdate(self,0);
                    </OnUpdate>
                    <OnTextChanged>
                        self.cursorOffset = self.cursorOffset or 0;
                        self.cursorHeight = self.cursorHeight or 0;
                        ScrollingEdit_OnTextChanged(self);
                    </OnTextChanged>
 
09-12-10, 11:20 AM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Assuming you have the ScrollFrame/ScrollChild hierarchy correct, shouldn't it look more like:
Code:
	<EditBox name="$parentEdit" enableMouse="true" multiLine="true" autoFocus="false">
		<Size x="264" y="281"/>
		<Scripts>
			<OnCursorChanged function="ScrollingEdit_OnCursorChanged"/>
			<OnTextChanged>
				ScrollingEdit_OnTextChanged(self, self:GetParent())
			</OnTextChanged>
			<OnUpdate>
				ScrollingEdit_OnUpdate(self, elapsed, self:GetParent())
			</OnUpdate>
 
09-15-10, 05:07 PM   #3
tayedaen
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 13
Originally Posted by Vrul View Post
Assuming you have the ScrollFrame/ScrollChild hierarchy correct, shouldn't it look more like:
Code:
	<EditBox name="$parentEdit" enableMouse="true" multiLine="true" autoFocus="false">
		<Size x="264" y="281"/>
		<Scripts>
			<OnCursorChanged function="ScrollingEdit_OnCursorChanged"/>
			<OnTextChanged>
				ScrollingEdit_OnTextChanged(self, self:GetParent())
			</OnTextChanged>
			<OnUpdate>
				ScrollingEdit_OnUpdate(self, elapsed, self:GetParent())
			</OnUpdate>
No.
If self.parent is not supplied, then blizzard is adding it for itself. I looked at the code, believe me.
This has nothing to do with my findings.

Even with your code I get the same error:
Code:
Message: Interface\FrameXML\UIPanelTemplates.lua:379: attempt to perform arithmetic on field 'cursorOffset' (a nil value)
Time: 09/16/10 00:55:04
Count: 6
Stack: Interface\FrameXML\UIPanelTemplates.lua:379: in function `ScrollingEdit_OnUpdate'
Interface\FrameXML\UIPanelTemplates.lua:356: in function `ScrollingEdit_OnTextChanged'
[string "*:OnTextChanged"]:1: in function <[string "*:OnTextChanged"]:1>
 
09-15-10, 06:19 PM   #4
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Well the functions ScrollingEdit_OnCursorChanged, ScrollingEdit_OnTextChanged, and ScrollingEdit_OnUpdate are the same on live and beta. That leaves the parenting of your ScrollFrame/EditBox in question (since it is not shown) or you are overlooking the ScrollingEdit_OnCursorChanged difference between what I posted and what you posted (since that is where cursorOffset and cursorHeight are set).
 
09-16-10, 05:55 AM   #5
tayedaen
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 13
Hm, I was detecting this while updating my addon for cataclysm.

The parenting is ok.

But perhaps in cataclysm, for locales other then deDE, ScrollingEdit_OnTextChanged is called before ScrollingEdit_OnCursorChanged.
That would explain the differences I see.
 
 

WoWInterface » AddOns, Compilations, Macros » Cataclysm Beta » EditBox: cursorOffset and cursoHeight

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