Shoutbox

Scripting: OnEvent_ChatWndSendMessage not fired correctly - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! Bug Reports (/forumdisplay.php?fid=7)
+----- Thread: Scripting: OnEvent_ChatWndSendMessage not fired correctly (/showthread.php?tid=70404)

Scripting: OnEvent_ChatWndSendMessage not fired correctly by Choli on 01-07-2007 at 02:43 AM

hi,

I've noticed that OnEvent_ChatWndSendMessage is also executed when the user clicks the send button of the chat window while holding the Shift or Ctrl keys. In that case, Messenger does not send the message but it inserts a new line character (the same as if you press Shift + Enter or Ctrl + Enter).

I think that Plus! just sees that the uses clicked on "Send" and it fires OnEvent_ChatWndSendMessage, without actually caring if Messenger is sending the message or not. Is this a bug or a limitation?

Apart from that, I've also noticed that if OnEvent_ChatWndSendMessage returns anything in that case, the string returned is placed in the edit area of Messenger (replacing whatever the user had typed before) and after that, Messenger inserts the new line at the begining of the text.

Well, Plus shouldn't call OnEvent_ChatWndSendMessage in that case :)


RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by deAd on 01-07-2007 at 03:13 AM

Yeah, definitely a bug! A workaround would be to check if the keys are down when the event is fired, but it's not the best way to do it.

quote:
Originally posted by Choli
Apart from that, I've also noticed that if OnEvent_ChatWndSendMessage returns anything in that case, the string returned is placed in the edit area of Messenger (replacing whatever the user had typed before) and after that, Messenger inserts the new line at the begining of the text.
That's because in order to preserve custom emoticon usage, Plus! just changes the text to whatever you return :P (it also sends text by adding it to the input box and simulating input to send it).
RE: RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by CookieRevised on 01-07-2007 at 04:34 AM

quote:
Originally posted by deAd
quote:
Originally posted by Choli
Apart from that, I've also noticed that if OnEvent_ChatWndSendMessage returns anything in that case, the string returned is placed in the edit area of Messenger (replacing whatever the user had typed before) and after that, Messenger inserts the new line at the begining of the text.
That's because in order to preserve custom emoticon usage, Plus! just changes the text to whatever you return :P (it also sends text by adding it to the input box and simulating input to send it).

That's not what Choli means though, he just describes the setting up for the bug to happen. The important part, and the description of the bug, is:
quote:
...and after that, Messenger inserts the new line at the begining of the text.
;)
RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by Matti on 01-07-2007 at 10:03 AM

Hmm... I never knew you could use Shift + Send / Ctrl + Send, but I could perfectly reproduce this bug. I hope Patchou will take a look here, since it is a major bug IMHO.


RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by Choli on 01-07-2007 at 12:57 PM

quote:
Originally posted by CookieRevised
...and after that, Messenger inserts the new line at the begining of the text.
nah, that's just a side effect... the important thing is that OnEvent_ChatWndSendMessage is called when a message has not been sent.
quote:
Originally posted by deAd
That's because in order to preserve custom emoticon usage, Plus! just changes the text to whatever you return  (it also sends text by adding it to the input box and simulating input to send it).
ah, ok... (this is also a curiosity, not the real bug)
RE: RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by CookieRevised on 01-07-2007 at 05:00 PM

quote:
Originally posted by Choli
quote:
Originally posted by CookieRevised
...and after that, Messenger inserts the new line at the begining of the text.
nah, that's just a side effect...
which shouldn't happen. The new line should be at the end...

------------------

Dead's reply is about
quote:
Apart from that, I've also noticed that if OnEvent_ChatWndSendMessage returns anything in that case, the string returned is placed in the edit area of Messenger
Which I replied upon by saying that
quote:
Apart from that, I've also noticed that if OnEvent_ChatWndSendMessage returns anything in that case, the string returned is placed in the edit area of Messenger
is the description/reproduction of
quote:
...and after that, Messenger inserts the new line at the begining of the text.

------------------

To say it in another way: Dead only replied to your observation that Plus! (correctly) replaces the text with the returned string. But the important bit in your first post in that paragraph is the very last part that Plus! does not insert the new line properly.
RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by Choli on 01-07-2007 at 06:16 PM

quote:
Originally posted by CookieRevised
that Plus! does not insert the new line properly.
it is not Plus who inserts the new line, it's Messenger. And Messenger insserts it where the cursor is at that moment. If Plus deletes the old text, calls OnEvent_ChatWndSendMessage and puts the returned string in the edit area again, then the cursor is placed at the begining, where messenger inserts the new line :P

quote:
Originally posted by CookieRevised
which shouldn't happen. The new line should be at the end...
of course, but it's a side efect, because if Plus didnt call OnEvent_ChatWndSendMessage, the new line will be placed correctly. I said it's a side effect because of that :P

Anyway, let's hope patchou reads and fixes all this (at the end we're talking about the same thing)
RE: RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by CookieRevised on 01-08-2007 at 11:48 PM

quote:
Originally posted by Choli
quote:
Originally posted by CookieRevised
that Plus! does not insert the new line properly.
it is not Plus who inserts the new line, it's Messenger. And Messenger insserts it where the cursor is at that moment. If Plus deletes the old text, calls OnEvent_ChatWndSendMessage and puts the returned string in the edit area again, then the cursor is placed at the begining, where messenger inserts the new line :P
Are you sure Plus! clears the text area before OnEvent_ChatWndSendMessage is called? That seems strange... since Plus! can't know if the text is going to be parsed or not.

If text is not going to be parsed, Plus! will intercept the push on the send button and fires ChatWndSendMessage event and a new line is added after the existing text. Or ... a new line is added after the existing text and Plus! fires a ChatWndSendMessage event. Either way, line is added after the text.

If text is going to be parsed, Plus! will intercept the push on the send button and fires ChatWndSendMessage event, text is replaced (and cursor should be at the end in this case) and a new line is added after the existing text. Or ... a new line is added after the existing text and Plus! fires a ChatWndSendMessage event and the existing text is replaced (doubt this is how it works). Either way, line is added after the text.

Where did I screw up? (note: didn't tested anything of this... I'm lazy atm :p)

quote:
Originally posted by Choli
(at the end we're talking about the same thing)
very true... but I wanna know the -why- :D
RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly by Choli on 01-10-2007 at 08:26 PM

quote:
Originally posted by CookieRevised
Are you sure Plus! clears the text area before OnEvent_ChatWndSendMessage is called? That seems strange... since Plus! can't know if the text is going to be parsed or not.

If text is not going to be parsed, Plus! will intercept the push on the send button and fires ChatWndSendMessage event and a new line is added after the existing text. Or ... a new line is added after the existing text and Plus! fires a ChatWndSendMessage event. Either way, line is added after the text.

If text is going to be parsed, Plus! will intercept the push on the send button and fires ChatWndSendMessage event, text is replaced (and cursor should be at the end in this case) and a new line is added after the existing text. Or ... a new line is added after the existing text and Plus! fires a ChatWndSendMessage event and the existing text is replaced (doubt this is how it works). Either way, line is added after the text.

Where did I screw up? (note: didn't tested anything of this... I'm lazy atm )
it doesn't matter if plus is going to replace text or not... the thing is that unless you do explicitly, when you put text in an edit box, the cursor possition is at the begining of the text. (with "you put" i mean "a program puts"). The possition is moved when the user pushes keys and types, not when Plus sets the texts of the edit box. And that's done before executing Messenger's code of the button (which Plus always thinks it's going to send the message). That's why when Plus finishes its work, it lets Messenger execut tis code, which in this case is to insert a new line at the possition, which is the begining because Plus (unconsciously) changed it.