WoW:UIHANDLER OnEnterPressed: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
Line 14: Line 14:
     self:ClearFocus(); -- clears focus from editbox, (unlocks key bindings, so pressing W makes your character go forward.
     self:ClearFocus(); -- clears focus from editbox, (unlocks key bindings, so pressing W makes your character go forward.
     ChatFrame1EditBox:SetFocus(); -- if this is provided, previous line is not needed (opens chat frame)
     ChatFrame1EditBox:SetFocus(); -- if this is provided, previous line is not needed (opens chat frame)
  end;
  end);
   
   
If you want to open chat frame when pressing enter instead of adding a new line, then add this script to your EditBox frame.
If you want to open chat frame when pressing enter instead of adding a new line, then add this script to your EditBox frame.

Revision as of 14:42, 18 December 2012

Widget handlers < OnEnterPressed

Description

Icon-edit-22x22.png
Note: This is a generic section stub. You can help expand it by clicking Sprite-monaco-pencil.png Edit on the section title.

EditBox:OnEnterPressed()

Arguments

Icon-edit-22x22.png
Note: This is a generic section stub. You can help expand it by clicking Sprite-monaco-pencil.png Edit on the section title.

Example

Icon-edit-22x22.png
Note: This is a generic section stub. You can help expand it by clicking Sprite-monaco-pencil.png Edit on the section title.
EditBox:SetScript("OnEnterPressed", function(self)
    self:ClearFocus(); -- clears focus from editbox, (unlocks key bindings, so pressing W makes your character go forward.
    ChatFrame1EditBox:SetFocus(); -- if this is provided, previous line is not needed (opens chat frame)
end);

If you want to open chat frame when pressing enter instead of adding a new line, then add this script to your EditBox frame.