Apparently the frame does need to be named.
m (catfix) |
(Apparently the frame does need to be named.) |
||
| Line 32: | Line 32: | ||
-- Create our editbox (may not need a name, untested) | -- Create our editbox (may not need a name, untested) | ||
local editbox = CreateFrame("EditBox", "myEditBox", UIParent, "ChatFrameEditBoxTemplate") | local editbox = CreateFrame("EditBox", "myEditBox", UIParent, "ChatFrameEditBoxTemplate") | ||
editbox:SetText("/command here") | |||
ChatEdit_SendText(editbox) | |||
However as of 3.3.5 you must set the chatFrame variable on your editbox before the OnLoad function runs. So if you want to use the above code you need to create the frame in XML or create a template and then use that template to create the frame. | |||
<EditBox name="MyAddOnEditBoxTemplate" inherits="ChatFrameEditBoxTemplate" virtual="true"> | |||
<Scripts> | |||
<OnLoad> | |||
self.chatFrame = self:GetParent(); | |||
ChatEdit_OnLoad(self); | |||
</OnLoad> | |||
</Scripts> | |||
</EditBox> | |||
And then use: | |||
-- Create our editbox | |||
local editbox = CreateFrame("EditBox", "MyAddOnEditBox", UIParent, "MyAddOnEditBoxTemplate") | |||
editbox:SetText("/command here") | editbox:SetText("/command here") | ||