Jump to content
Developer Wiki and Function Reference Links ×

How to handle each event on PIO with object styles


Jord Visser

Recommended Posts

I'm trying to set-up a PIO with support for 'red' symbols.

I tried digging trough the SDK files to find out how to handle all the different events that get emitted during Object Style actions, but so far I'm unable dissect what to do on which event.

Looking in MiniCadCallBacks.h for my guidance at the moment...

 

Is there a walkthrough of what to do at which event?

Link to comment
  • 2 months later...

Hi

 

There is not much to be done, as most of it should be handled by the default implementation.

I use a custom class (VWStyledParametricObj) to help with this which I attached (had to zip it as the file extensions weren't allowed). This class also holds some comments on what each action is for.

 

This is an example of how I implemented it:

 

EObjectEvent ElectricalDevice_EventSink::OnEditPluginStyle(MCObjectHandle symDefHandle)
{
	return VWStyledParametricObj::OnEditPluginStyle_Default(symDefHandle);
}

EObjectEvent ElectricalDevice_EventSink::OnCreatePluginStyle(MCObjectHandle symDefHandle)
{
	return VWStyledParametricObj::OnCreatePluginStyle_Default(symDefHandle);
}

EObjectEvent ElectricalDevice_EventSink::OnUpdateStyledObject(MCObjectHandle symDefHandle)
{
	// Copy over the saved references...
	EPluginStyleParameter ParameterStyle = gSDK->GetPluginStyleParameterType(fhObject, "__ManageOperatingAreas");
	if(ParameterStyle == kPluginStyleParameter_ByStyle)
	{
		VWSymbolDefObj symDef(symDefHandle);
		MCObjectHandle hObject = symDef.GetFirstMemberObject();
		if(hObject && VWDeviceObj::GetDeviceType(hObject) != eDeviceType::kUnkownDevice)
		{
			sOperatingAreaArray Areas;
			OperatingArea::Get(hObject, Areas);
			OperatingArea::Save(fhObject, Areas);
		}
	}
	
	return VWStyledParametricObj::OnUpdateStyledObject_Default(symDefHandle);
}

EObjectEvent ElectricalDevice_EventSink::OnFinalizeCreatePluginStyle(MCObjectHandle symDefHandle)
{
	/*EObjectEvent Result =*/ VWStyledParametricObj::OnFinalizeCreatePluginStyle(symDefHandle, VWDeviceObj::GetStyleMap());
	
	return VWStyledParametricObj::OnFinalizeCreatePluginStyle_Default(symDefHandle);
}

EObjectEvent ElectricalDevice_EventSink::OnFinalizeUpdateStyledObject(MCObjectHandle symDefHandle)
{
	return VWStyledParametricObj::OnFinalizeUpdateStyledObject_Default(symDefHandle);
}

 

StyledPlugins.zip

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...