Properties Sheet Script Behavior

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

Moderator: Gurus

gpswaney
Posts: 7
Joined: Sun Apr 01, 2012 4:13 pm

Properties Sheet Script Behavior

Post by gpswaney » Sat Oct 27, 2012 4:37 am

I have written a script which creates an additional properties sheet, based on the example shown on the MM wiki for using the SDB.UI.AddPropertiesSheet method. The framework of the script is:

Sub SetupPDFsheet
Dim i
i = SDB.UI.AddPropertiesSheet("PDF File", Script.ScriptPath, "InitPDFsheet", "TrackChange",_
"SavePDFsheet", 5)
End Sub
Sub InitPDFsheet(Sheet)
...
End Sub
Sub TrackChange( Object, ObjectType)
...
End Sub
Sub SavePDFsheet(Sheet, Object, ObjectType)
...
End Sub

PROBLEM 1:
Clicking the "OK" button results in a call to "SavePDFsheet," as expected. The problem is, clicking the "Cancel" button also causes a call to "SavePDFsheet," which makes no sense to me. Is there a reason for this? I don't see how the code inside the routines could cause this problem, so I think it's a bug. The "Cancel" button should only cause a call to an (internal) routine to destroy the sheet, which is not among the routines I can access through this interface, is it?

PROBLEM 2:
My sheet has an edit box. I have noticed that if the edit box has the focus, clicking the "OK" button triggers the OnExit event for the edit box (as expected), but does not proceed to save the sheet and close the dialog. This requires a second click of the "OK" button. If the edit box does not have the focus, one click of the "OK" button does it. It's as though the edit box swallows the first click and prevents the "OK" button from getting it. Any ideas? Are these two problems related?

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

Re: Properties Sheet Script Behavior

Post by aramando » Fri Jan 25, 2013 8:55 am

Bump.

I have just noticed this behaviour, too (well, "problem 1", anyway). I am certain it must be a bug.

Below is the code I am using. The "SaveSheet" message appears however the track properties box is dismissed, not only if changes are accepted using the "OK" button.

Code: Select all

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

Sub InitSheet(Sheet)
End Sub

Sub TrackChange(Object, ObjectType) 
End Sub

Sub SaveSheet(Sheet, Object, ObjectType)
	SDB.MessageBox "SaveSheet", mtInformation, Array(mbOk) 
End Sub
MediaMonkey 4.0.7.1511
Windows 7 SP1

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

Re: Properties Sheet Script Behavior

Post by aramando » Fri Jan 25, 2013 12:02 pm

I’ve discovered another way in which the AddPropertiesSheet function is apparently broken (at least with respect to its documented operation).

The function passed to the SaveProcedure parameter is not only always called when a properties sheet dialogue is closed (regardless of whether the changes were accepted or cancelled), it is also never called when moving directly between tracks’ properties using the next/previous buttons, even when track properties have been changed. So, in practice, SaveProcedure is really just the opposite of InitSheet, called when the track properties window is closed, irrespective of any other factor.

In looking into how to work around this I’ve been playing with the OnTrackProperties event, and discovered this to be apparently broken too. This generally looks like quite a good method of responding to actual track properties changes; it appears to fire only when a track’s properties have been changed and those changes are accepted, not if they are cancelled. However, if you change a track’s properties and then use the next/previous buttons to view another track’s properties, the event will fire on every subsequent track regardless of whether the properties have been changed or not, until you close the track properties window.

EDIT: I've posted threads in the bug reports forum here and here.

Post Reply