1

Resolved

Diagram.Model.SelectedShapes() cause exception.

description

Calling the Diagram.Model.SelectedShapes() function raises a NullException.
 
Please see the attatched example :).

file attachments

comments

scottgblood wrote Jan 13, 2009 at 10:00 AM

I have implemented my own change to get this working at the moment, it works internally but might not be a good solution as it keeps the dictionaries modifiable (if thats a word).

The changes are.

I have changed the virtual function SelectedShapes in Model.cs from...

public virtual Shapes SelectedShapes()
    {
        if (_selectedShapes == null) GetSelectedElements();
        return _selectedShapes;
    }
to...

public virtual Shapes SelectedShapes()
    {
        if (_selectedShapes == null | _selectedShapes.Count == 0) GetSelectedElements();
        return _selectedShapes;
    }
And have also changed the ResetSelectedElements method from...
public void ResetSelectedElements()
    {
        _selectedElements = null;
        _selectedShapes = null;
        _selectedLines = null;        
}

to...

public void ResetSelectedElements()
    {
        _selectedElements = null;
        _selectedShapes = null;
        _selectedLines = null;

        // Added by Scott

        _selectedElements = new Elements();
        _selectedElements.SetModifiable(true);

        _selectedShapes = new Shapes();
        _selectedShapes.SetModifiable(true);

        _selectedLines = new Lines();
        _selectedLines.SetModifiable(true);
    }

JamesWestgate wrote Jan 22, 2009 at 9:37 PM

Model.ResetSelectedElements() not being called from selectable_SelectedChanged in diagram.cs. Insert event from Model.Shapes not reaching diagram control.

wrote Jan 22, 2009 at 9:38 PM

JamesWestgate wrote Jan 27, 2009 at 3:03 PM

This has been resolved in the next build.

wrote Jan 27, 2009 at 3:03 PM

JamesWestgate wrote Jan 27, 2009 at 3:04 PM

** Closed by JamesWestgate 1/27/2009 8:03 AM

JamesWestgate wrote Jan 27, 2009 at 3:04 PM

wrote Jan 27, 2009 at 3:05 PM

wrote Feb 14, 2013 at 7:33 PM

wrote May 16, 2013 at 9:39 AM

wrote May 16, 2013 at 9:39 AM

wrote Jun 14, 2013 at 7:13 AM