Difference between revisions of "ISDBTreeNode::RelatedObjectID"

From MediaMonkey Wiki
Jump to: navigation, search
(Formatting, added links)
 
Line 3: Line 3:
 
===Property description===
 
===Property description===
  
This value returns ID of related object (i.e. Artist ID for artist nodes, Playlist ID for playlist nodes, Album ID for album nodes, ...)
+
This value returns ID of related object depending on [[ISDBTreeNode::NodeType|node type]], such as:
 +
* [[ISDBArtist::ID|Artist ID]] for artist nodes,
 +
* [[ISDBPlaylist::ID|Playlist ID]] for playlist nodes,
 +
* [[ISDBAlbum::ID|Album ID]] for album nodes.
  
Introduced in MediaMonkey 4.0
+
''Introduced in MediaMonkey 4.0.''
  
 
===Example code===                     
 
===Example code===                     
 
<source lang="vb">
 
<source lang="vb">
  'This Example will Add Random Song from Selected playlist to NowPlaying
+
'This Example will Add Random Song from Selected playlist to NowPlaying
  Dim res
+
Dim res
  If (SDB.MainTree.CurrentNode.NodeType = 61) Or (SDB.MainTree.CurrentNode.NodeType = 71) Then 'Check if selected node is playlist
+
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
+
  Set playlst = SDB.PlaylistByID(SDB.MainTree.CurrentNode.RelatedObjectID) 'retrieve playlist data
    Randomize 'Init Random Seed
+
  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
+
  Call SDB.Player.PlaylistAddTrack(playlst.tracks.item(Int((playlst.Tracks.Count+1) * Rnd))) 'Add Random Track From Playlist to Now Playing
  Else
+
Else
    res = SDB.MessageBox( SDB.Localize("You must select Playlist!"), mtError, Array(mbOk)) 'Show warning in case playlist is not selected
+
  res = SDB.MessageBox(SDB.Localize("You must select Playlist!"), mtError, Array(mbOk)) 'Show warning in case playlist is not selected
End If
+
End If
 
</source>
 
</source>
  

Latest revision as of 18:47, 20 April 2013

CoClass SDBTreeNode, Interface ISDBTreeNode

Property Get RelatedObjectID As Long


Property description

This value returns ID of related object depending on node type, such as:

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