getmusicbee.com

Support => Developers' Area => MusicBee API => Topic started by: codingduo on September 29, 2020, 09:41:13 PM

Title: How to get a library selection event?
Post by: codingduo on September 29, 2020, 09:41:13 PM
Hi there,

we're developing a plugin which creates a panel with moods which allows the user to select the moods he wants to add to his files by simply clicking a checkbox (see screenshot below).

We can update the panel by playing a file (double clicking in the library panel). Now we want to listen to a single selection event on the same panel.

To be more concrete:

The user selects a file in the library panel and we want our moodtagger panel to update.

Do you have any solution for this?

Thank you in advance!



Screenshot:

https://imgur.com/1EcP9rv
Title: Re: How to get a library selection event?
Post by: Steven on September 29, 2020, 10:29:55 PM
Seems an obvious thing to have but its not supported. I will add an event to the next v3.4 beta
Title: Re: How to get a library selection event?
Post by: codingduo on September 30, 2020, 12:46:40 PM
Thank you for the quick response! Looking forward to the next beta.  :)
Title: Re: How to get a library selection event?
Post by: Steven on October 10, 2020, 05:00:24 AM
If you add the following void function to the Plugin class, MB will detect it and call it whenever the selected file changes

Code
public void OnSelectedFilesChanged(string[] filenames) {
}

https://getmusicbee.com/patches/MusicBee34_Patched.zip
unzip and replace the existing musicbee application files
Title: Re: How to get a library selection event?
Post by: codingduo on October 12, 2020, 02:32:51 PM
Thank you very much Steven! We'll try it.
Title: Re: How to get a library selection event?
Post by: codingduo on October 13, 2020, 08:37:25 PM
Everything works as expected except for the deselection (e.g. CTRL+Mouseclick) of list entries in the library. We appreciate if you can add this as well. Thank you in advance.
Title: Re: How to get a library selection event?
Post by: Steven on October 13, 2020, 10:06:36 PM
I am not able to reproduce any issues with de-selection and see no reason for it not to work.
If you are sure it is not working, then can you provide a set of steps with a screenshot as well
Title: Re: How to get a library selection event?
Post by: codingduo on October 21, 2020, 09:19:56 PM
Hi. So we implemented the OnSelectedFilesChanged method and added a breakpoint. And in debug mode, we did not get a break at this point when we deselect one of the entries on the library panel. We recorded a short GIF for you. Hopefully it makes things clearer to you.

https://i.imgur.com/QFQBibX.gif

Kind regards
Title: Re: How to get a library selection event?
Post by: Steven on October 22, 2020, 08:06:03 AM
I still cant reproduce this. Can you send a link to your settings file (help/ support/ view settings)
Title: Re: How to get a library selection event?
Post by: codingduo on October 22, 2020, 12:17:51 PM
Sure. Here you go:

https://www.dropbox.com/s/ho64bqza9hlj06e/MusicBee3Settings.ini?dl=0

Thank you!  :)
Title: Re: How to get a library selection event?
Post by: Steven on October 22, 2020, 09:55:45 PM
This should fix the issue:
https://getmusicbee.com/patches/MusicBee34_Patched.zip
Title: Re: How to get a library selection event?
Post by: codingduo on October 29, 2020, 09:39:52 AM
Thank you Steven! It works now.