Event OnTrackProperties fires inappropriately.

This forum is for reporting bugs in MediaMonkey for Windows 4. Note that version 4 is no longer actively maintained as it has been replaced by version 5.

Moderator: Gurus

aramando
Posts: 5
Joined: Thu Jan 24, 2013 1:06 pm

Event OnTrackProperties fires inappropriately.

Post by aramando »

The OnTrackProperties event should fire when changes to a track's properties are accepted (i.e. the user clicks OK or the next/previous track buttons in the track properties editor window, having made changes).

However, it can fire even if a track's properties have not changed, in the following circumstances: if one track's properties are changed, then the event will fire for every consecutive track whose properties are subsequently viewed until the track properties window is closed.

Steps to reproduce:
1) Save the following code to a .vbs file in %AppData%\Roaming\MediaMonkey\Scripts\Auto and restart MediaMonkey

Code: Select all

Option Explicit
 
Sub OnStartUp
	Dim i : i = SDB.UI.AddPropertiesSheet("Test sheet", Script.ScriptPath, "InitSheet", "TrackChange", "SaveSheet", 1)
End Sub

Dim InEventHandler : InEventHandler = False
Script.RegisterEvent SDB, "OnTrackProperties", "Event_OnTrackProperties"
 
Sub InitSheet(Sheet) 
End Sub
 
Sub TrackChange( Object, ObjectType) 
End Sub
 
Sub SaveSheet(Sheet, Object, ObjectType) 
End Sub

Sub Event_OnTrackProperties(SongList) 
    If InEventHandler Then Exit Sub   
    InEventHandler = True 
	SDB.MessageBox "Track properties changed: " & SongList.Item(0).Title, mtInformation, Array(mbOk)	
    InEventHandler = False                 	
End Sub
2) Open a track properties window and make a change.
3) Click one of the "update and previous/next song" buttons.
4) Observe that the event fires, correctly.
5) Click one of the "update and previous/next song" buttons one or more times, followed by the OK button, without making any changes.
6) Observe that the event fires each time, even though the 2nd and subsequent tracks' properties were not changed.

I have tested this on the latest stable and beta builds available today (4.0.7.1511 and 4.1.0.1622 dev build).