Shoutbox

msgplus windows [RESOLVED] - 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: Scripting (/forumdisplay.php?fid=39)
+----- Thread: msgplus windows [RESOLVED] (/showthread.php?tid=82818)

msgplus windows [RESOLVED] by Hen on 03-30-2008 at 04:52 PM

Hi,
I open a window from the chat window using MsgPlus.CreateWnd command.
I have some even from a control button in the window.
Then I want from the window to send a message as a result from this button control.
But if the only parameters of OnWindowIdEvent are "wnd" and "controlID" how can I know to who to send the message?
If I just write SendMessage("test") it doesnt work.
Thanks.


----------

Hi,
I declared a global var, and where I created the window, I also wrote:
flag=ChatWnd
Later, when I had input from control in the window, I did that:
flag.SendMessage("test")
and its working....


RE: msgplus windows [RESOLVED] by CookieRevised on 03-30-2008 at 06:12 PM

Excellent that you've found a solution yourself (y)...

But here is a trick question to consider:
What if there are more than one chat windows, and more than one custom window open? How are you going to determine to whom to send the message in that case?


Or a similar question/ thing to consider:
1) Open a chat window
2) From there open the custom window, but don't yet press the button to send a message
3) Open another chat window
4) From there open a second custom window again, but don't yet press the button to send a message
5) Switch back to the first custom window
6) Now press the button in this first custom window to send the message
-> You'll see that the message will be send to the wrong contact



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

PS: Read the Scripting Documentation carefully for every single function you use. eg: Remember that before you use SendMessage you should always check if you actually can send a message. Especially if the sending will not be done immediatly after recieving a message. This is explained in the Scripting Documentation:

quote:
Originally posted by Scripting Documentation - ChatWnd:: SendMessage
The EditChangeAllowed property should be checked before this function is called.






;)