WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Cataclysm Beta (https://www.wowinterface.com/forums/forumdisplay.php?f=82)
-   -   EditBox: cursorOffset and cursoHeight (https://www.wowinterface.com/forums/showthread.php?t=34929)

tayedaen 09-12-10 08:56 AM

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>


Vrul 09-12-10 11:20 AM

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>


tayedaen 09-15-10 05:07 PM

Quote:

Originally Posted by Vrul (Post 205934)
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>


Vrul 09-15-10 06:19 PM

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).

tayedaen 09-16-10 05:55 AM

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.


All times are GMT -6. The time now is 10:32 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI