THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/08/2006 at 21:32, xxxxxxxx wrote:
Here is a sample extracted from one of my projects. Note that the DescID used to get portID is for a description resource belonging to my plugin tag. This should be the same for built-in objects - use the description resource enum from the header (e.g.: Obase.h).
GvNode* dnode = nodeMaster->CreateNode(root, ID_OPERATOR_OBJECT, NULL, x+96, y);
if (!dnode) return FALSE;
// This is a node for a plugin tag
dnode->OperatorSetData(GV_ATOM, tag, GV_OP_DROP_IN_BODY);
LONG portID = GvCall(dnode->GetOperatorData(), GetMainID)(dnode, GV_PORT_INPUT, DescID(DescLevel(IPPDIAL_SLAVEVALUE)));
GvPort* dport = dnode->AddPort(GV_PORT_INPUT, portID, GV_PORT_FLAG_IS_VISIBLE, TRUE);
if (!dport) return FALSE;
// - Set Object node reference type
BaseContainter* bc = dnode->GetOpContainerInstance();
bc->SetLong(GV_OBJECT_PATH_TYPE, GV_OBJECT_PATH_TYPE_ABSOLUTE);
// - Connect last input to SlaveNode
// -- For IsConnectionValid()
NodePort input;
input.node = constNode;
input.port = constPort;
GvNode* sout = NULL;
GvNode* din = NULL;
GvPort* spout = NULL;
GvPort* dpin = NULL;
if (!nodeMaster->IsConnectionValid(input.node, input.port, dnode, dport, sout, spout, din, dpin))
return FALSE;
dnode->AddConnection(sout, spout, din, dpin);
EventAdd();
HTH,