Thread Tools Display Modes
06-13-09, 04:16 PM   #1
Kelgar
A Defias Bandit
Join Date: Apr 2008
Posts: 2
/focus

What I'm trying to do is make a button to set a focus.
I tried something like this:
line = "/focus";
--ChatFrameEditBox:setText("");
ChatFrameEditBox:Insert(line);
ChatEdit_SendText(ChatFrameEditBox);
But it say that it's protect by Blizzard.
So I was wondering how to do it.
  Reply With Quote
06-13-09, 04:41 PM   #2
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
As far as I know the /focus slash command calls the FocusUnit() function. This function (among others) is protected meaning that it can only be called by secure code (the Blizzard user interface). In short, it cannot be used in such a fashion.
__________________
  Reply With Quote
06-13-09, 05:47 PM   #3
Recluse
A Cliff Giant
 
Recluse's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 70
Originally Posted by Tristanian View Post
As far as I know the /focus slash command calls the FocusUnit() function. This function (among others) is protected meaning that it can only be called by secure code (the Blizzard user interface). In short, it cannot be used in such a fashion.
Interesting. http://www.wowwiki.com/API_FocusUnit - I had no idea that they removed such a command. From the sound of it, you can't even call it from a secure action button object, which is silly. Evil bots ruining it for us.

As an alternative, you could just put /focus into a macro and drag it to an action button.
__________________
We'd be together, but only diamonds last forever...
  Reply With Quote
06-14-09, 04:56 AM   #4
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Originally Posted by recluse View Post
Interesting. http://www.wowwiki.com/API_FocusUnit - I had no idea that they removed such a command. From the sound of it, you can't even call it from a secure action button object, which is silly. Evil bots ruining it for us.

As an alternative, you could just put /focus into a macro and drag it to an action button.
http://www.wowwiki.com/SecureActionButtonTemplate

Focus can be set as a type attribute for SecureActionButtons. Gladius/Proximo have used this for right-click focusing on frames.
  Reply With Quote
06-14-09, 05:12 PM   #5
Kelgar
A Defias Bandit
Join Date: Apr 2008
Posts: 2
Thanks Waverian, it's working perfectly
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » /focus

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