WoW:UIHANDLER OnTabPressed: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m (Not a talk page, doesn't need signatures. Consolidated code into one example. Changed "this" to "self".)
Line 3: Line 3:
  EditBox:OnTabPressed()
  EditBox:OnTabPressed()


You can only append or prepend a tab no matter what. I don't think there's a way to insert a tab at the cursor position,
  EditBox:SetScript("OnTabPressed", function(self)
unless there's a function that will get the position of the cursor. [[User:Egingell|Egingell]] 09:27, 13 April 2007 (EDT)
    self:Insert("   "); -- ''(4 spaces)''
 
Possible for inserting a tab character("\t")?
  EditBox:SetScript("OnTabPressed", function()
  this:SetText(this:GetText().."\t");
  end;
  end;
 
   
-- As documented by [[user:egingell|egingell]]
 
 
 
 
 
OnTabPressed event, insert an indent with:
  EditBox:Insert("    "); ''(4 spaces)''
This will insert 4 spaces at your cursor's position. A tab character or \t will not work, therefore spaces are used.
This will insert 4 spaces at your cursor's position. A tab character or \t will not work, therefore spaces are used.
--[[user:Muckles|Muckles]]


{{DEFAULTSORT:OnTabPressed}}
{{DEFAULTSORT:OnTabPressed}}

Revision as of 23:45, 8 April 2009

WoW API

EditBox:OnTabPressed()
EditBox:SetScript("OnTabPressed", function(self)
    self:Insert("    "); -- (4 spaces)
end;

This will insert 4 spaces at your cursor's position. A tab character or \t will not work, therefore spaces are used.

Warning: Default sort key "OnTabPressed" overrides earlier default sort key "UIHANDLER OnTabPressed".