On 29/04/2016 at 00:38, xxxxxxxx wrote:
Hi,
As you've already find out, to store per-layout data for your dialog use BFM_LAYOUT_SETDATA and BFM_LAYOUT_GETDATA messages. Let see how they have to be used.
For instance in the ActiveObjectDialog example of cinema4dsdk we could save the "Lock Element"checkbox status (stored in the dialog class as lock member):
Bool ActiveObjectDialog::Message(const BaseContainer& msg, BaseContainer& result)
{
switch (msg.GetId())
{
case BFM_LAYOUT_SETDATA: // Called when a new layout is set
{
// Retrieve layout data to set with the message ID
const BaseContainer *bc = msg.GetContainerInstance(BFM_LAYOUT_SETDATA);
if (bc)
{
// Obtain dialog layout container with the unique ID of the plugin
const BaseContainer* data = bc->GetContainerInstance(ID_ACTIVEOBJECT);
if (data)
{
lock = data->GetBool(0);
}
}
return true;
}
case BFM_LAYOUT_GETDATA: // Called when a layout is saved
{
// Setup dialog layout container
BaseContainer data;
data.SetBool(0, lock);
// result container has to be initialized with ID 0
result = BaseContainer(0);
// Set dialog layout container with the unique ID of the plugin
result.SetData(ID_ACTIVEOBJECT, data);
return true;
}
}
return GeDialog::Message(msg, result);
}
Bool ActiveObjectDialog::InitValues(void)
{
if (!GeDialog::InitValues())
return false;
// Lock Element checkbox has to be initialized here
// Otherwise saved layout data isn't reflected
SetBool(IDC_AO_LOCK_ELEMENT, lock);
...
return true;
}