by
Krull McSkull >> Sun, 28 Feb 1999 20:24:37 GMT
Hi Lukas,
So far i have been using the sendMsg method of the Object class to call a method by its name. This is fine, my question is, how do you pass parameters into the method when using the sendMsg method ?
The Object::sendMsg method doesn't handle parameters. However, there is a method in the JADE external method support library (jomsup.dll) called sendMsgWithParams, which is designed to handle a dynamic list of parameters and an optional return value. There are no external methods defined in RootSchema that use this because you need to define a separate method for each method signature you want to call. For example:
sendMsg1(msg : String; number : Integer) is sendMsgWithParams in jomsupp;
sendMsg2(msg : String; object : Object) is sendMsgWithParams in jomsupp;
sendMsg3(msg : String; param1 : Integer; param2 : Object) : Boolean is sendMsgWithParams in jomsupp;
A small 'trick' is required to define these methods due to a restriction in the JADE development environment. The development environment does not allow you to select or use libraries such as jomsupp that are defined in RootSchema in user sub-schemas. The JADE compiler does not have this restriction. The following steps will allow you to work around the JADE restriction:
1. If you don't have any libraries defined in your sub-schema, add a library, 'dummy' say to your schema from the Browse menu, select Libraries, then Library|Add Library.
2. Add your external method using library 'dummy', it should look something like this:
sendMsgx() is sendMsgWithParams in dummy;
2. Modify your external method definition to take the parameters you require and change the library name from 'dummy' to 'jomsupp' and recompile:
sendMsg3(msg : String; param1 : Integer; param2 : Object) : Boolean is sendMsgWithParams in jomsupp;