ISDBTreeNode::RelatedObjectID
Jump to navigation
Jump to search
CoClass SDBTreeNode, Interface ISDBTreeNode
Property Get RelatedObjectID As Long
Property description
This value returns ID of related object depending on node type, such as:
- Artist ID for artist nodes,
- Playlist ID for playlist nodes,
- Album ID for album nodes.
Introduced in MediaMonkey 4.0.
Example code
'This Example will Add Random Song from Selected playlist to NowPlaying
Dim res
If (SDB.MainTree.CurrentNode.NodeType = 61) Or (SDB.MainTree.CurrentNode.NodeType = 71) Then 'Check if selected node is playlist
Set playlst = SDB.PlaylistByID(SDB.MainTree.CurrentNode.RelatedObjectID) 'retrieve playlist data
Randomize 'Init Random Seed
Call SDB.Player.PlaylistAddTrack(playlst.tracks.item(Int((playlst.Tracks.Count+1) * Rnd))) 'Add Random Track From Playlist to Now Playing
Else
res = SDB.MessageBox(SDB.Localize("You must select Playlist!"), mtError, Array(mbOk)) 'Show warning in case playlist is not selected
End If