Adding ActiveX Controls as Graphic Objects into an Rogue Wave Views Application > Presentation of the Rogue Wave Views Application of this Example > Step 4: Adding a Browser
 
Step 4: Adding a Browser
This step shows how to add a browser. You may use a control chooser to get the identifier of the control. You just have to use the value returned by the show function as the identifier, in the same way you use the value returned by IlvFileBrowser::show() to get a filename.
Here is the new code for the member function doIt:
void
MakeNodeInteractor::doIt(IlvRect& size)
{
// the manager should actually be a grapher.
IlvGrapher* grapher = ILVDYNAMICCAST(IlvGrapher*, manager());
if (!grapher)
return;
// Creates the new IlvGraphicCOMAdapter object.
IlvControlBrowser cBrowser(getView());
const char* identifier = cBrowser.show();
if (!identifier)
identifier = DefaultIdentifier;
IlvGraphic* obj = new IlvGraphicCOMAdapter(size, identifier, getDisplay());
// Deselects the previous object(s) if any.
grapher->deSelect();
// Adds the new object as a node into the grapher.
grapher->addNode(obj, IlvTrue, grapher->getInsertionLayer());
// Selects it.
grapher->makeSelected(obj);
// Deals with the commands if needed.
if (grapher->isUndoEnabled())
grapher->addCommand(new IlvAddNodeCommand(grapher, obj,
grapher ->getInsertionLayer()));
}
The class IlvControlBrowser is defined in the header file ilviews/windows/cbrowser.h. You must add the library oledlg.lib in order to be able to use this class.

Version 5.5.1
Copyright © 2012, Rogue Wave Software, Inc. All Rights Reserved.