quote:
Originally posted by Shondoit
Well, actually, Cooldude wants the same as me, to pass parameters to the PlusWnd object...
Only he wants to pass a method, and I want to pass an Object
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:
String.prototype.trim = function() {
return this.replace(/(^\s|\s$/g, "");
}
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...