1162: Script.UnRegisterEvents SDB Not working

MediaMonkey 4.1 beta testing is now underway...

Moderator: Gurus

1162: Script.UnRegisterEvents SDB Not working

Postby MoDementia » Sun Apr 20, 2008 8:27 pm

On one script it will eventually Unregister the events but I have to force it through the code multiple times before it does it.

The other script I cant force it through the same code so it never gets unregisterd.

Last time I know it was working was maybe 1155
[EDIT] Actually I'm not sure it has ever worked the way I have been using it (see code below)
Last edited by MoDementia on Sun Apr 20, 2008 9:17 pm, edited 1 time in total.
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia


Postby MoDementia » Sun Apr 20, 2008 9:14 pm

Code: Select all
Sub OnStartup

  Script.RegisterEvent SDB, "OnTrackConverted", "OnConverted"
  If ini.BoolValue("SyncTheSync","WriteTags") = True Then
    Script.RegisterEvent SDB, "OnTrackProperties", "OnProperties"
  End If

End Sub

Sub SaveSyncTheSyncSheet(Sheet1)

  Script.UnRegisterEvents SDB
  Script.RegisterEvent SDB, "OnTrackConverted", "OnConverted"
  If ini.BoolValue("SyncTheSync","ActivateSyncTheSync") = True Then
    If ini.BoolValue("SyncTheSync","WriteTags") = True Then
      Script.RegisterEvent SDB, "OnTrackProperties", "OnProperties"
    End If
  End If

End Sub
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Postby MoDementia » Fri Apr 25, 2008 5:18 pm

So always use the new event mechanism where you can. Only for option panels (sheets) this is not yet possible. There you'll need to store values between the main program and the event handlers in SDB.Objects, in the INI or in the Registry.


Will sheets be fixed in a version sometime soon ?
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Postby MoDementia » Fri Apr 25, 2008 5:28 pm

If I call a subroutine from within the save sheet to set the events will it work?


Code: Select all
Sub OnStartup

  Script.RegisterEvent SDB, "OnTrackConverted", "OnConverted"
  If ini.BoolValue("SyncTheSync","WriteTags") = True Then
    Script.RegisterEvent SDB, "OnTrackProperties", "OnProperties"
  End If

End Sub

Sub SaveSyncTheSyncSheet(Sheet1)

Call  SetEvents(ini.BoolValue("SyncTheSync","ActivateSyncTheSync"),ini.BoolValue("SyncTheSync","WriteTags"))

End Sub

Sub SetEvents(Activate,WriteTags)

  Script.UnRegisterEvents SDB
  Script.RegisterEvent SDB, "OnTrackConverted", "OnConverted"
  If Activate = True Then
    If WriteTags = True Then
      Script.RegisterEvent SDB, "OnTrackProperties", "OnProperties"
    End If
  End If

End Sub
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Postby MoDementia » Wed May 28, 2008 8:57 pm

MoDementia wrote:Will sheets be fixed in a version sometime soon ?
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Postby jiri » Fri May 30, 2008 8:45 am

Yes, I see the problem with this old way of event handling. We will look into it and will try to fix it for the next version (i.e. 3.1).

Jiri
jiri
 
Posts: 5087
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic

Postby MoDementia » Fri May 30, 2008 3:57 pm

Thanks
MoDementia
 
Posts: 1320
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia


Return to MediaMonkey for Windows Beta Testing

Who is online

Users browsing this forum: No registered users and 14 guests