Good morning @Havremunken,
Is there a particular message I am listening for? Or is there another way to be notified of a parameter change outside of GetVirtualObjects?
In order to listen to parameter changes you can implement the Message
function in your plugin and listen for the MSG_DESCRIPTION_POSTSETPARAMETER
message. Cast the incoming data
argument to DescriptionPostSetValue
to extract the ID of the changed parameter and get the value through the node
argument.
Sample code taken from here and adjusted slightly:
Bool OMyPlugin::Message(GeListNode* node, Int32 type, void* data) {
BaseContainer* bc;
...
if (type == MSG_DESCRIPTION_POSTSETPARAMETER)
{
// Get message data
DescriptionPostSetValue* dparm = (DescriptionPostSetValue*)data;
Int32 parameterId = (*(dparm->descid))[0].id;
bc = static_cast<BaseObject*>(node)->GetDataInstance();
switch (parameterId)
{
case FILE_PATH: // Check for the parameter ID of the file path parameter.
// Load the file via bc->GetString(FILE_PATH).
ApplicationOutput(bc->GetString(FILE_PATH));
break;
}
}
...
}
This way you could also initiate the cancellation of the current loading process in case the file path is being changed while a file is already being loaded. Alternatively you could lock the parameter in the description using GetDEnabling
while the file is being loaded.
From a UX point of view I recommend indicating the current processing status to the user so the user knows whether a file is loading or if the loading has finished/failed.
And a personal flavor hint: I'm used to providing control buttons (Load/Start/Import/... and Cancel) for potential long running operations. This way it is clear and intuitive to the user how to use your object.
Cheers,
Daniel