Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

UIHANDLER OnCursorChanged

Last wiki revision 2023-10-28

Called whenever the cursor in an edit box was moved. Note that the cursor is also moved when typing.

  • arg1 : the new horizontal (x) position of the cursor in the edit box (the first column being 0, increasing to the right)
  • arg2 : the new vertical (y) position of the cursor in the edit box (the first line being 0, DEcreasing downwards)
  • arg3 : the width of the displayed cursor
  • arg4 : the height of one line/the displayed cursor

Say we have a plain textbox inside a scrollframe (inside UIPanelScrollFrameTemplate; as the only child-element, etc.), the following code will automatically move scrollframe viewport so that the cursor is inside it. (The ScrollingEdit_OnUpdate function in UIPanelTemplates.lua does something akin to this also.) <OnCursorChanged> local vs = self:GetParent:GetVerticalScroll; local h = self:GetParent:GetHeight; if vs+arg2 > 0 or 0 > vs+arg2-arg4+h then self:GetParent:SetVerticalScroll(arg2*-1); end </OnCursorChanged>

Source

https://warcraft.wiki.gg/wiki/UIHANDLER_OnCursorChanged · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.