Scripting: OnEvent_ChatWndSendMessage not fired correctly |
Author: |
Message: |
Choli
Elite Member
Choli
Posts: 4714 Reputation: 42
43 / /
Joined: Jan 2003
|
O.P. Scripting: OnEvent_ChatWndSendMessage not fired correctly
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
|
|
01-07-2007 02:43 AM |
|
|
deAd
Scripting Contest Winner
Posts: 1060 Reputation: 28
– / /
Joined: Jan 2006
|
RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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 (it also sends text by adding it to the input box and simulating input to send it).
|
|
01-07-2007 03:13 AM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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 (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.
This post was edited on 01-07-2007 at 04:35 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
01-07-2007 04:34 AM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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.
|
|
01-07-2007 10:03 AM |
|
|
Choli
Elite Member
Choli
Posts: 4714 Reputation: 42
43 / /
Joined: Jan 2003
|
O.P. RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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)
|
|
01-07-2007 12:57 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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.
This post was edited on 01-07-2007 at 05:05 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
01-07-2007 05:00 PM |
|
|
Choli
Elite Member
Choli
Posts: 4714 Reputation: 42
43 / /
Joined: Jan 2003
|
O.P. RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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
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
Anyway, let's hope patchou reads and fixes all this (at the end we're talking about the same thing)
|
|
01-07-2007 06:16 PM |
|
|
CookieRevised
Elite Member
Posts: 15517 Reputation: 173
– / /
Joined: Jul 2003
Status: Away
|
RE: RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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
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 )
quote: Originally posted by Choli
(at the end we're talking about the same thing)
very true... but I wanna know the -why-
This post was edited on 01-08-2007 at 11:50 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|
|
01-08-2007 11:48 PM |
|
|
Choli
Elite Member
Choli
Posts: 4714 Reputation: 42
43 / /
Joined: Jan 2003
|
O.P. RE: Scripting: OnEvent_ChatWndSendMessage not fired correctly
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.
|
|
01-10-2007 08:26 PM |
|
|
|