Event OnChangedSelection between nodes

Beta Testing for Windows Products and plugins

Moderator: Gurus

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

Event OnChangedSelection between nodes

Post by MoDementia » Mon Mar 24, 2008 12:19 am

Maybe not a bug but certainly inefficient

Changing from 1 node to the other i.e. from artist & album artist to album artist

Selected sequence

First track in AAA
First track in AAA
First track in AAA
First track in AA

Triggered 4 times for what is effectively 1 changed selection (maybe 2 if you count the node)

then within the track list changing selection results in

First track
First track
New track

After that it is just 1 per selection change.

I just had a message pop up every time the event was triggered displaying artist

I thought my script was looping some how but now think the event is getting triggered too many times

jiri
Posts: 5395
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri » Thu Apr 17, 2008 3:44 am

In order to not cause more bad than good just before 3.0.3 release, I'd rather leave this as is, but we will look into it for the future versions.

Jiri

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

Post by MoDementia » Thu Apr 17, 2008 9:34 am

Cheers

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

Re: Event OnChangedSelection between nodes

Post by MoDementia » Sat Jan 24, 2009 4:39 pm

Not in Mantis

Save as OnSelection.vbs in Scripts\Auto\

Code: Select all

Sub OnStartup
      Script.RegisterEvent SDB, "OnChangedSelection","OnSelection"
End Sub

Sub OnSelection
      SDB.MessageBox "Onselection Triggered", mtError, Array(mbOk)
End Sub

jiri
Posts: 5395
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Event OnChangedSelection between nodes

Post by jiri » Thu Feb 05, 2009 12:49 pm

This is caused by the way how events are handled internally in MM. So, unless it causes serious problems in some cases (please describe, if you have an example), I'd prefer not fixing this, since it could introduce other problems, particularly for already existing scripts.

Jiri

Teknojnky
Posts: 5533
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: Event OnChangedSelection between nodes

Post by Teknojnky » Mon Feb 09, 2009 5:27 pm

Not sure what problems it could cause by fixing, but I know that it would help avoid problems caused by a script being called multiple times when it does not have some time type of mutex to ensure that it not called multiple times in rapid succession for what should be a single event.

see also

http://www.mediamonkey.com/forum/viewto ... =2&t=36256

ZvezdanD
Posts: 3098
Joined: Thu Jun 08, 2006 7:40 pm

Re: Event OnChangedSelection between nodes

Post by ZvezdanD » Mon Apr 05, 2010 5:56 am

Oh well. You MM developers are not serious and don't respect your scripters at all. I mean, it is great if you decide to implement suggestions of some scripters, even if they are breaking compatibility with some existing scripts, but I expect at least to see some public information about that. You didn't mention anywhere that you changed OnChangedSelection behavior with 3.1.0.1251. even not in the wiki. I spent several hours trying to find what is wrong with my script with the latest MM version, knowing that it worked fine with older MM versions.

Well, now I know that OnChangedSelection is generated only once when some node changed, but it is very discussable if you should generate that event before (as it is now implemented) or after some node is changed. I expect in my event handler that it is generated after the current node is already changed, not before. Well, if you want to be really attentive, you should add one more event, let say OnChangingSelection, which should be generated before some node is changed.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

Post Reply