SDB.Tree.CurrentNode

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

SDB.Tree.CurrentNode

Post by trixmoto » Sun Jan 24, 2010 11:58 am

I'm having trouble with setting "SDB.Tree.CurrentNode". It works fine with a node in a small(ish) tree like my "Album Artist" list, but if I do exactly the same with a node in a larger tree like my "Artist" list then MM goes to "Not Responding" and churns away using 50% of my CPU indefinitely. Any one got an ideas?

For reference, here is the code I'm using...

Code: Select all

On Error Resume Next
Dim tree : Set tree = SDB.MainTree
Dim node : Set node = tree.Node_Library
Dim arr : arr = Array("Artists","Coldplay")
Dim i : i = 0
Dim l : l = UBound(arr)
For i = 0 To l
  Dim c : c = arr(i)
  If i < l Then
    c = SDB.Localize(c)
  End If
  node.Expanded = True
  Set node = tree.FirstChildNode(node)
  Do While ((node.Caption <> c) Or (node.Visible = False))
    node.Expanded = False
    Set node = tree.NextSiblingNode(node)
    If Err.Number <> 0 Then
      Err.Clear
      Exit Function
    End If
  Loop
Next
tree.CurrentNode = node    '<--- even though this is a valid node, it sometimes crashes
node.Expanded = True
On Error Goto 0
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: SDB.Tree.CurrentNode

Post by trixmoto » Sun Jan 24, 2010 12:17 pm

After about 3 hours debugging through and fighting with this, almost immediately after I posted this I discovered that putting "SDB.ProcessMessages" in directly before "tree.CurrentNode = node" seems to fix the problem! :D
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Post Reply