[INDENT]Data Frame Name (Name: <dyn type="dataFrame" name="Main Map" property="name"/>) This is the name of the identified data frame as specified on the Data Frame Properties dialog box. The data frame is identified by the name attribute name="Main Map". This value, as well as the tag, is updated every time the data frame's name is changed.[/INDENT]
The name of the dataframe in the Name tag is not updated and it appears that the data frame name displayed in the dynamic text is that of the active data frame when a new one is activated.
I understand how dynamic text works, but I now think that there is a bug or at least an unexpected, undocumented behavior.
If one ads the following correct DynText to a document that has the "Main Map" dataframe as well as others, and then removes the "Main Map" dataframe, the DynText shows the name of the active dataframe while NOT updating the value of its Name tag.
I would have expected that the layout would behave like it does with other DynTags, for ex. by displaying [Empty], or that it would update the value of the Name tag to the name of the active dataframe. I couldn't see that behavior documented anywhere and it threw me off while programming a complex application.
PS: Writing such DynText with an invalid dataframe name is a good trick if one wants to display the name of the active dataframe as the DynText is still "alive"!... but that's not what I was trying to do!
No, based on the current documentation, the value of the Name tag is supposed to be the name of a dataframe; not the active dataframe. It is true that when inserted from the ArcMap menu, it automatically takes the name of the active dataframe (which is logical). And in retrospect, it may be a good thing that it shows the name of the active dataframe although a warning should also be given.
Where there is a problem is when ArcMap doesn't update the value of the name TAG when the dataframe of that name has been removed. Ideally, it should warn the user that the tag no longer corresponds to an existing dataframe and inform that the value of tag will be set to a reserved keyword to reflect that it will now on display the name of the active dataframe, for ex. ArcMap_ActiveDataFrame (or whatever keyword that is unlikely going to be used to name a real-live dataframe). Currently the TAG is left to the name of the removed dataframe.
At the very least the behavior that it takes when the value of the Name tag is no longer correct should be documented.
The application I am programming starts with the value of the name tag and then tries to find the dataframe of that name. The way things stand now, that dataframe may not exist! That should be documented; it would have saved me a couple of days trying to figure out what was wrong in my complex program... while it was matching Esri's documentation and was logical.