Pass object to a Wnd - 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: Pass object to a Wnd (/showthread.php?tid=64788) Pass object to a Wnd by Shondoit on 08-11-2006 at 01:56 PM
I need some kind of method, to pass a custom Object to a PlusWnd, so I can use it again when the OnWindowEvent_CtrlClicked event fires.... code: This doesn't work, but I need something that has the same effect RE: Pass object to a Wnd by -dt- on 08-11-2006 at 02:09 PM What i do is create a hidden field on the window (in the xml) set that to a random ID, then store the object in a global array with that ID then when my event fires i read the ID from the Window and look it up in the array RE: Pass object to a Wnd by Shondoit on 08-11-2006 at 02:12 PM
I already considered that, but I need the object itself, I want it to be a standalone object, not dependant of any arrays. RE: Pass object to a Wnd by -dt- on 08-11-2006 at 02:16 PM well Wnd isnt a normal object, neither is any of the Plus! objects your only real way to do what you want is via what i said, which i dont see whats so wrong about it... RE: Pass object to a Wnd by CookieRevised on 08-11-2006 at 06:10 PM
quote: make and declare your object variable as a global variable, not as a local one: code: RE: Pass object to a Wnd by Shondoit on 08-11-2006 at 10:58 PM
Well, thats what I do now, but when you do it like this, you need to now the name of the global object, and I don't want that, I want the object itself, so a user can name it whatever he likes... RE: Pass object to a Wnd by cooldude_i06 on 08-12-2006 at 05:40 AM
quote: Yeah, I was also looking for a way to do this. It would be great if this could be extended for methods so you could add predefined methods for a Window object. Also it would be REALLY great if you could add methods to the Window class so that all windows will inherit that method(only in the current script ofcourse). RE: RE: Pass object to a Wnd by CookieRevised on 08-13-2006 at 09:28 AM
quote:What you ask for is something entirly different than what Shondoit asks for, if I read correctly... As a matter of fact, I don't know exactly what Shondoit tries to do though as his request is a bit vague and as it is now, it seems a bit pointless. A detailed example (pseudo-code) would be helpfull, Shondoit... What you, cooldude_i06, ask for is adding your own methods and functions to the special interfaces of Messenger Plus!. I also requested a method for this some while ago here. RE: Pass object to a Wnd by Shondoit on 08-13-2006 at 12:46 PM
Well, actually, Cooldude wants the same as me, to pass parameters to the PlusWnd object... RE: Pass object to a Wnd by CookieRevised on 08-13-2006 at 06:10 PM
quote:Which are totally two different things... 1) You don't pass methods, you add methods to existing objects. A method is a function. It makes no sense to "pass" it to another object. "Passing" is a term used in context of variables and functions. 2) You don't pass stuff to windows, you pass stuff to functions. A window isn't something which can perform stuff; it's a dead thing only visible on the screen. The functions supporting the window can perform stuff. Hence it makes no sense to pass something to "a window". You pass something to the function which controls the window. And for this you don't need any fancy thing at all, just a global variable (which holds the object or whatever else) since those are the things which are "passed" to and used between functions. So, the two things asked are in fact two different things (unless you or cooldude described something different than what you actually wanted). As for your own problem, Shondoit, a detailed (pseudo-) code example would be very helpfull in explaining to us what you actually are trying to accomplish. And maybe in that way I also can explain better that the thing you ask for and what cooldude asks for is actually totally different. --- To add your own methods to objects, you use the prototype method. eg: code:will add a trim method to the string object. Note that the stuff which Plus! adds to JScript aren't objects but mainly interfaces, you can not use the protoype method to add your own methods to them... RE: Pass object to a Wnd by Shondoit on 08-13-2006 at 06:25 PM
So maybe we phrased it a bit awkward... RE: Pass object to a Wnd by cooldude_i06 on 08-13-2006 at 06:44 PM
I think I know what Shondoit is asking for. He basically wants to give Window class custom properties. code: RE: RE: Pass object to a Wnd by Shondoit on 08-13-2006 at 06:47 PM
Exactly, but you could also use: code:Or code: RE: Pass object to a Wnd by cooldude_i06 on 08-13-2006 at 06:54 PM Right, but Cookie asked that question and there doesnt seem to be a way to do it. Though I do agree that would make things a big easier (and tidy). RE: RE: Pass object to a Wnd by CookieRevised on 08-13-2006 at 10:27 PM
quote:Indeed you did. And as such both of you requested a different thing (while you probably meant the same thing). quote:I did learned such things... see my previous request. |