QSA-interest Archive, January 2006
How to use a string-variable as QSObject in a script
Message 1 in thread
Hi out there
I would like to ask if there is a possibility in QSA 1.2.0 to use a string
variable for calling static functions of a class with the name of that
string:
function getRegisteredWrapper( className )
{
var obj;
var objArray = Application.getRegObjArray( className );
//////////////// I would like to make the next line work //////////
if( "className".canConvert( objArray[0] )
obj = objArray[0];
return obj;
}
All Wrapper-Objects in my app have the static function "canConvert".
Any ideas?
If that is not possible yet, it´s a suggestion for QSA 2.0.
Greetings
Jens
To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx
Message 2 in thread
Jens G. wrote:
>//////////////// I would like to make the next line work //////////
> if( "className".canConvert( objArray[0] )
>
>
Hi, Jens.
You're calling the method canConvert on a String-object here, which will
not work. What you can do is
if (eval("className" + ".canConvert(objArray[0])"))
You will also have to register the class using an QSObjectFactory with a
staticDescriptor to be able to call static functions on it.
best regards,
Eskil
To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx