View Issue Details

IDProjectCategoryView StatusLast Update
0009098MMW v4Framework: Scripts/Extensionspublic2012-02-06 14:51
Reporterzvezdan Assigned To 
PrioritynoneSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Summary0009098: FirstChildNode removes a sign for expanding node from collapsed nodes
DescriptionFirstChildNode method removes sign for expanding node as if a node has not child nodes. It does that for many nodes, especially those that are not previously expanded/collapsed, which also means that it behaves like that only for collapsed nodes. Such behavior is since I remember, maybe even in MM2.

Here is the test code:

Option Explicit

Sub OnStartUp()
    Dim mnuTest

    Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
    mnuTest.Caption = "Plus Sign Test"
    mnuTest.OnClickFunc = "Test"
    mnuTest.UseScript = Script.ScriptPath
End Sub

Sub Test(oItem)
    Dim oPrntNode
    Dim oTreeNode

    Set oPrntNode = SDB.MainTree.CurrentNode
    If oPrntNode Is Nothing Then Exit Sub

    Set oTreeNode = SDB.MainTree.FirstChildNode(oPrntNode)
End Sub
Steps To Reproduce- Restart the program, so none node is expanded by default;
- expand Entire Library;
- select Location node;
- choose Edit | Test -> there is still [+] sign (i.e. sign for expanding nod) in the front of Location node, but when you hoover a mouse cursor over the Location node it would disappear.
Additional InformationI am using something like this to overcome that problem:
bHasChildren = oPrntNode.HasChildren
Set oTreeNode = SDB.MainTree.FirstChildNode(oPrntNode)
...
oPrntNode.HasChildren = bHasChildren
TagsNo tags attached.
Fixed in build

Activities

jiri

2012-02-06 10:44

administrator   ~0030296

Yes, that's how it works in the underlying tree control and so we decided to expose this as is.

zvezdan

2012-02-06 12:00

updater   ~0030300

Well, your answer is not surprise for me, it is like usual.

This is obviously a bug and should be treated like that. The FirstChildNode method should not affect HasChildren property, especially not if node actually has children, i.e. FirstChildNode (and subsequent NextSiblingNode) returns something different than Nothing.

If this is so hard for you resolve, you should at least document that in wiki.

jiri

2012-02-06 12:08

administrator   ~0030301

Do you mean that you have an example where FirstChildNode really does return a node, but it modified HasChildren property to false? That would certainly be a bug.

zvezdan

2012-02-06 14:51

updater   ~0030303

I am sorry, you are right. FirstChildNode doesn't return a node but Nothing if its parent is not been previously expanded. However, in my opinion, that is also some kind of a bug if some parent node must be previously expanded if we want FirstChildNode and HasChildren to return correct values. At least you should state that in wiki.