Profile Picture

Why I get NULL from NDrawingDocument.ActiveLayer ???

Posted By Lu zehan 14 Years Ago
Author
Message
Lu zehan
cry Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 4, Visits: 1

I put some shapes onto the document, then serialize the ActiveLayer of current document and save it to a file.

After I deserialize from the FileStream and get NLayer instance (nLayerInstance), Then

 

CurrentNDrawingDocument.Layers.AddChild(nLayerInstance);

nLayerInstance.BringToFront();

 

Then the shape appears. But cannot be selected.

In this case, if I call "NDrawingDocument.ActiveLayer", I will get "null".

does anybody have meet this problem? How did you resolved? Thanks



Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Lu,

Only the shapes in the currently active document layer are editable and hence selectable. After you add the layer to the drawing Layers collection you need to call:

drawing.ActiveLayer = nLayerInstance;

Best Regards,
Nevron Support Team



Lu zehan
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 4, Visits: 1

Thanks, but NDrawingDocument.ActiveLayer is READONLY!?



Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Our mistake - use this code instead:

drawing.ActiveLayerUniqueId = layer.UniqueId;

Best Regards,
Nevron Support Team



Lu zehan
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 4, Visits: 1

Thank you, resolved.



Pramod Sreekanthan
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)Junior Member (17 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 17, Visits: 1

Hi,

After deserializing,

Even after assigning activelayeruniqueid = layer.uniqueid,

It gives active layer as null.

If we try to add a new layer to the layers. it says document.Layers is null.

Pramod

 



Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi, Pramod,
send your sample project to support@nevron.com, we'll investigate your code and tell you what's wrong with it.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic