This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Error with Select object

Hello.. I have selected the rectangle & Ellips in multilayerviewer ,when i added to the multilayerviewer, its making unhandeled exception.. I attached a sample ,you please check it and give me appropriate way to select object at the adding time to layer...pls help me soon..
Hello,

I tried attached sample and got the error. However, I could not figure out what causes it. Could you please clarify whether you made some changes with this sample?
sorry.. I have Changed in the function "UpdateObjectsListBox()" line no:2735 to 2738, which is i have selected the objects by selecting Objectlist box first item.. I have also tried to select objects from multilayer mouse_up events,

ie, if(_objectsListBox.Items.Count>0)
_objectsListBox.SelectedIndex = 0; its also not correct...

actually, i want to select the objects(by code) when its add to multlayerviewer. is it have any function to select vobjects?
Hello,

Here is code sample which, I hope, will be helpful:

I suggest to add new code to the method Form1._multiLayerViewer_LayerChanged(...), as it processes "ObjectAdded" event which we need. Here is this part:

if (e.ChangeType == Aurigma.GraphicsMill.WinControls.LayerChangeType.ObjectAdded)
{
	UpdateObjectsListBox();
	ClearAddObjectToggle();
	UpdateVObjectContextMenu((Aurigma.GraphicsMill.WinControls.VObject) e.VObject);

    // New code to perform selection of
    // the added object.
    BeginInvoke((MethodInvoker)delegate
    {
        _multiLayerViewer.CurrentDesigner = e.VObject.Designer;
    });
}

Note, that I have to use BeginInvoke() to let CreationDesigner to finish its part of object's initialization. And I have to confirm that it is not the most obvious behavior.