Shoutbox

Get chatwindow - 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: Get chatwindow (/showthread.php?tid=69012)

Get chatwindow by SnuZZer on 11-30-2006 at 07:09 PM

Hi.
When a item on my list is doubleclicked it shall send a file, but to send a file U need to know which window I'm using right now, but it isn't possible with the function - or is it?

Here is my code:

code:
function OnBibliotekEvent_LstViewDblClicked(Wnd, Id, Handling)
{
    ChatWindowInUse.SendFile(Wnd.LstView_GetItemText("liste",Handling,1));
}

Thanks in advance.
RE: Get chatwindow by Spunky on 11-30-2006 at 07:15 PM

You could iterate the chat windows or even pass the chatwnd object (when you enter a command) to a global variable... It is very possible :p


RE: Get chatwindow by SnuZZer on 11-30-2006 at 07:29 PM

Hi.
I'm sorry I don't understand. Can you give an example?


RE: Get chatwindow by Spunky on 11-30-2006 at 07:34 PM

code:
var CurrentChat;

function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    if(Message=="/command"){
        CurrentChat = ChatWnd;
        MsgPlus.CreateWnd("xmlfile.xml","Bibliotek");
    }
}

function OnBibliotekEvent_LstViewDblClicked(Wnd, Id, Handling){
    CurrentChat.SendFile(Wnd.LstView_GetItemText("liste",Handling,1));
}[code]
[/code]
RE: Get chatwindow by CookieRevised on 12-01-2006 at 04:30 AM

quote:
Originally posted by SnuZZer
Hi.
I'm sorry I don't understand. Can you give an example?
This is were those "global variables" we talked about here come into play:

look at the CurrentChat variable in SpunkyLoveMuff's script..

When the user enters the command, the OnEvent_ChatWndSendMessage event is fired.

There the CurrentChat variable is set to hold the chatwindow object of the window where that command was entered in (you get that object passed from the OnEvent_ChatWndSendMessage event itself, see ChatWnd parameter).

Then the window with that list is created and when the user double clicks an item in that list, the file is send to the chatwindow object which was set in the CurrentChat variable.