On 28/06/2017 at 07:35, xxxxxxxx wrote:
Both actually. I want to present the "Add In/Out Port" menus and after that, execute them.
GetOperatorData seems to do the trick. Here's a snippet I'm using in my GeUserArea's InputEvent method.
// "node" is a GvNode processed earlier
BaseContainer names, ids, popupbc;
GeData gedata;
GvOperatorData* gvopdata = node->GetOperatorData();
// get inports from node
Int32 ct = gvopdata->FillPortsMenu( node, names, ids, ID_GV_VALUE_TYPE_NONE, GV_PORT_INPUT, GV_MESSAGE_FIRST_DATA_ID );
// iterate from FillPortsMenu, then add popup menu entries.
Int32 i = 0, bcindex;
while ( true )
{
bcindex = names.GetIndexId( i++ );
if ( bcindex == NOTOK )
{
break;
}
popupbc.SetString( ids.GetInt32( bcindex ), names.GetString( bcindex ) );
}
Int32 screenx = msg.GetInt32( BFM_INPUT_X ),
screeny = msg.GetInt32( BFM_INPUT_Y );
Local2Screen( &screenx, &screeny );
Int32 menuselect = ShowPopupMenu( nullptr, screenx, screeny, popupbc, POPUP_RIGHT );
// process selected menu entry
One problem right now is my code doesn't iterate through sub-containers yet (e.g. Coordinatess, Object Properties in an Object OperatorNode.) I'll try and figure it out later, then I'll post an update.
Thanks!