Thread Tools Display Modes
10-01-12, 08:18 AM   #1
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
How to correctly pre-hook ChatEdit_OnEnterPressed?

Hello,

I'm trying to pre-hook ChatEdit_OnEnterPressed in order to add a prefix string to the chat message the user is sending, on specific occasions (whispering to specific player for example). If the conditions are met, I then do editBox:SetText("myPrefixString"..origMsg)

This is working fine, and my prefix is added as expected.
However, when I tried to write in chat "/target XXX", I got a pop-up message telling me that my addon "has been blocked from an action only available to the Blizzard UI", and then disable/ignore buttons.

How can modify the text being sent without being blocked when executing commands like /target? Is there perhaps another way other than hooking ChatEdit_OnEnterPressed?

Thanks in advance!
  Reply With Quote
10-01-12, 09:07 AM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Hmm, actually ignore what I just said, I just reread your original post, I'm not sure I understood the problem before replying the first time

You could try hooking SendChatMessage() instead, it ends up getting called anyway from the editbox where messages are concerned.
It's going to be easier to differentiate chattype too and only modify messages you care for (eg. "WHISPER")

Last edited by Dridzt : 10-01-12 at 09:30 AM.
  Reply With Quote
10-01-12, 11:58 AM   #3
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Thank you!
It worked And it also solved my problem with WIM addon integration!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to correctly pre-hook ChatEdit_OnEnterPressed?


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