Thread Tools Display Modes
09-13-16, 03:41 AM   #1
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Modify the outline of the 'cursor' in an editbox

Hey,

I have been playing around with modifying the default UI's fontstrings. I added an outline to the editbox's input but i noticed something weird: It also adds on outline to the "|" which indicates where the cursor is positioned.

Is there a possibility to 'exclude' the cursor from being outlined? I added a picture for clarification. Showing the cursor with outline and without. You can clearly see the difference in spacing.
Attached Thumbnails
Click image for larger version

Name:	cursorpos.png
Views:	3574
Size:	10.1 KB
ID:	8816  
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘

Last edited by Miiru : 09-13-16 at 03:42 AM. Reason: Typo
  Reply With Quote
09-13-16, 12:10 PM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Miiru View Post
Hey,

I have been playing around with modifying the default UI's fontstrings. I added an outline to the editbox's input but i noticed something weird: It also adds on outline to the "|" which indicates where the cursor is positioned.

Is there a possibility to 'exclude' the cursor from being outlined? I added a picture for clarification. Showing the cursor with outline and without. You can clearly see the difference in spacing.
What for kind addon are you using to replace your chat? and please link the code
  Reply With Quote
09-17-16, 07:15 AM   #3
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
It seems like i found a work-around for this problem, but it needs some more testing. Especially i need to find a way to apply it to all text-input boxes without having to define them all. The chat-input should be the most important one though.

Lua Code:
  1. ChatFrame1EditBox:HookScript("OnCursorChanged",function(self)
  2.     local kids = { self:GetRegions() };
  3.     for _, child in ipairs(kids) do
  4.         if child:GetWidth() < 3 then
  5.             local point, relativeTo, relativePoint, xOfs, yOfs = child:GetPoint()
  6.             child:SetPoint(point, relativeTo, relativePoint, xOfs-1.5, yOfs )
  7.         end
  8.     end
  9. end)
Result:



edit: I found an even simpler solution:

Lua Code:
  1. ChatFrame1EditBox:HookScript("OnCursorChanged",function(self)
  2. local kids = { self:GetRegions() }
  3. local point, relativeTo, relativePoint, xOfs, yOfs = kids[2]:GetPoint()
  4. kids[2]:SetPoint(point, relativeTo, relativePoint, kids[1]:GetStringWidth()-2.5, yOfs)     
  5. end)
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘

Last edited by Miiru : 09-18-16 at 12:19 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Modify the outline of the 'cursor' in an editbox

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