Why does document.BrowserPanes.AddTreeBrowser make the document dirty?

Why does document.BrowserPanes.AddTreeBrowser make the document dirty?

LarsGaarde
Explorer Explorer
498 Views
4 Replies
Message 1 of 5

Why does document.BrowserPanes.AddTreeBrowser make the document dirty?

LarsGaarde
Explorer
Explorer

Is there anyway around this?

 

I'm trying to use a new TreeBrowserPane to show the user some temporary data that will not be saved in the document, but the fact that adding a TreeBrowserPane makes the document dirty is a problem, e.g. with files that are read-only or approved/checked into Vault.

 

I've tried setting the BrowserNodePane.Transient property after creating it, but at that point the document is already dirty.

 

Pseudocode here:

private void CreateBrowserPanePOC(Document document)
{
BrowserPanes oPanes;
oPanes = document.BrowserPanes;

BrowserNodeDefinition oDef;
oDef = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("some node", 3, ->a ClientNodeResource object<-);

 

System.Diagnostics.Debug.WriteLine($"Document Dirty = {document.Dirty}");

 

BrowserPane oPane;
oPane = oPanes.AddTreeBrowserPane("Filter", Globals.AddinGUI, oDef);

 

System.Diagnostics.Debug.WriteLine($"Document Dirty = {document.Dirty}");

 

oPane.Transient = true;

 

System.Diagnostics.Debug.WriteLine($"Document Dirty = {document.Dirty}");
}

 

Regards

Lars G.

0 Likes
499 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

The short answer is, because your working with the 'Document' to create it.  Any time you make any modification within a document, it wants to save it afterwards.  Creating a Tree Type Browser Pane within the document must qualify as modifying the document enough that it wants to ask you if you want to save the changes.

Is there some reason why a MessageBox written using vbNewLine to make it multi-line or InputListBox will not get the job done?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

LarsGaarde
Explorer
Explorer

It's part of a large add-in where the user will be able to interact with the nodes with contextmenus.

 

What confuses me is that the BrowserPane object has a property called Transient.

As i understand it, that would mean that the object created (the BrowserPane) wouldn't be saved in the file, but would be discarded, when the document is closed.

 

I am able to set the Transient flag to True once the BrowserPane has been created, but at that point the document is already dirty.

 

Actually, after looking at it a bit more it turns out that if i do set the Transient flag to true after creating the BrowserPane, then the BrowserPane object will NOT be saved to the file, but again: the file is already dirty, because i created the BrowserPane.

 

It's a bit of chicken/egg problem.

 

Lars G.

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

OK. That explains some things.  But I'm still not seeing a Transient property of a BrowserPane.

See the following link to the 2020 Inventor online Help item for the BrowsrePane Object.

http://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-9F6FC721-CCCB-4EA2-92D1-694DC5B12C22 

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

LarsGaarde
Explorer
Explorer

The transient property is not listed in the online Help or the API help files, but it does exist and setting it to true has the effect that I described in my previous post.

 

I'm using Inventor 2019 by the way and I haven't checked if this behavior is present in 2020, since 2019 is our primary target right now. But I would assume that it is.

 

Lars G.

0 Likes