Using CS5.5 debug
I have a "root" scripable object:
Object
{
kAxioModelObjectScriptElement, // object's script element ID
c_AxioModelEngine, // script PropID
"axiocat engine", // name
"access axiocat data model engine", // description
kCPrefs_CLSID, // Windows CLSID
NoCollectionInfo, // CollectionElementType (scriptID, name, descr, CLSID)
kPreferencesObjectScriptElement,
kPreferencesSuiteScriptElement,
}
.......
Method
{
kAxioModelObjectFindScriptElement,
e_AxioModelFind,
"get axiocat object",
"returns axiocat object",
ObjectType( kAxioUIObjectScriptElement ),
"axiocat object or null if not found"
{
p_AxioModelId, "key", "object id to find", StringType, kRequired,
}
}
Method getAxiocatObject(key) returns another object with next FR definition:
Class
{
kAxioUIObjectScriptBoss,
kBaseProxyScriptObjectBoss,
{
IID_ISCRIPT, kAxioUIObjectScriptImpl,
IID_ISCRIPTOBJECTKEY, kAxioUIObjectKeyScriptImpl,
}
},
Class
{
kAxioUIObjectScriptProviderBoss,
kBaseScriptProviderBoss,
{
IID_ISCRIPTPROVIDER, kAxioUIObjectScriptProviderImpl,
}
},
Object
{
kAxioUIObjectScriptElement, // object's script element ID
c_AxioUIObjectClass, // script PropID
"axiocat object", // name
"axiocat data model object", // description
kAxioUIObject_CLSID, // Windows CLSID
NoCollectionInfo, // CollectionElementType (scriptID, name, descr, CLSID)
kNonIDBasedObjectScriptElement, // base object element ID
kAxioModelObjectSuiteScriptElement, // suite element ID
}
.....
Provider
{
kAxioUIObjectScriptProviderBoss,
{
Parent{ kAxioModelObjectScriptElement },
RepresentObject { kAxioUIObjectScriptElement },
Property { kAxioUIObjectIdScriptElement, kReadOnly },
}
}
Question: when I call in script getAxiocatObject(key), ID produce ASSERT:
"HandleMethod request for method 'getAxiocatObject' on object 'axiocat engine' returned value for method 'xxxx'".
But object returned from this method is correct, and I see all object properties successfully.
What this ASSERT mean?
kAxioUIObjectScriptProviderBoss implementation, where I have doubt:
AxioUIObjectScriptProvider::::GetNumObjects( const IScriptRequestData* data, IScript* parent )
{
return 0;
}
AxioUIObjectScriptProvider::AppendNthObject( const IScriptRequestData* data, IScript* parent, int32 n, ScriptList& objectList )
{
return kSuccess;
}
It is a bad idea to name a method "get "..., because get is also an AppleScript keyword. Have you considered to implement a collection instead, and address your object by name?
Anyway, do you use e_AxioModelFind as requestID in your method implementation's call to AppendReturnData() ?
Dirk
It is a bad idea to name a method "get "..., because get is also an AppleScript keyword.
Fixed. Thank you.
Have you considered to implement a collection instead, and address your object by name?
I think, that it's not a good idea in my case. Collection require (as I understood) to create instance for each proxy object (thousands...)?
Anyway, do you use e_AxioModelFind as requestID in your method implementation's call to AppendReturnData() ?
Dirk, sorry about my triple looser head:
I returned c_AxioUIObjectClass:
InterfacePtr<IScript> script(Utils<IScriptUtils>()->CreateProxyScriptObject(data->GetReques tContext(), kAxioUIObjectScriptBoss, c_AxioUIObjectClass, parent));
if (script)
{
InterfacePtr<IStringData> idData( script, IID_ISCRIPTOBJECTKEY );
if( idData )
{
idData->Set(objid);
returnData.SetObject(script);
//data->AppendReturnData( parent, c_AxioUIObjectClass, returnData );
data->AppendReturnData( parent, e_AxioModelFind, returnData );
status = kSuccess;
}
}
North America
Europe, Middle East and Africa
Asia Pacific