Issues with new OnMouse/OnKey events

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

Moderator: Gurus

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

Issues with new OnMouse/OnKey events

Post by ZvezdanD » Sat Jan 31, 2009 10:06 am

Thanks so much to MM developers for those new events. However, I have some complains about them, considering same events within Visual Basic.

1. OnMouseMove should have Button argument as OnMouseDown and OnMouseUp, i.e. it should be Sub OnMouseMove(Button As Int, ShiftState As Int, X As Int, Y As Int)

2. In Visual Basisc when we click on some button, we have the next order of events:
- MouseDown
- Click
- MouseUp

With MM button we have the next order:
- OnMouseDown
- OnMouseUp
- OnClick

Also, when we press a key on some button in Visual Basic (and hold it some time), we have the next order of events:
- OnKeyDown
- OnKeyDown
...
- OnKeyDown
- OnKeyUp
- OnClick

With MM button we have the next order:
- OnKeyDown
- OnKeyDown
...
- OnKeyDown
- OnClick
- OnKeyUp

Well, this second issue with the executing order is not very important if you know what you are doing, but the first one with missing argument could be problematic in some situations.

By the way, when you added such fine events why you didn't add OnKeyPress as well?
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

Peke
Posts: 12500
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: Issues with new OnMouse/OnKey events

Post by Peke » Sat Jan 31, 2009 10:44 am

You are correct Noted here.
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

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

Re: Issues with new OnMouse/OnKey events

Post by jiri » Sat Jan 31, 2009 1:24 pm

Answer to both issues 1&2 is the same - the events are based on Delphi events and so the call order and parameters are the same as in Delphi. Note that ShiftState parameter can be used for getting info about the pressed button.

As for OnKeyPress, I don't think it's overly important, but ok, will look into it and probably add it.

Jiri

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

Re: Issues with new OnMouse/OnKey events

Post by ZvezdanD » Sat Jan 31, 2009 2:29 pm

We script developers are using VBScript programming language. It is made by Microsoft as limited variant of Visual Basic and has similar syntax as VB. It has almost nothing in connection with Delphi. So, I think that your API functions/events should follow Visual Basic logic, not Delphi.

ShiftState is argument that should tell us which shift key is pressed (Shift/Ctr/Alt), in combination with some another key. That another key should be found by Button argument, not by ShiftState. Why don't you use same arguments with OnMouseDown and OnMouseUp? Why those events have Button arguments if it is possible to get that information from ShiftState?
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

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

Re: Issues with new OnMouse/OnKey events

Post by jiri » Mon Feb 02, 2009 5:03 am

Sure, scripts are written in VBScript. I just wanted to say, that the calling order of events is based on how is it implemented in Delphi and changing the order doesn't seem to have any good reason, not mentioning possible bugs introduced.

I believe that the arguments of OnMouseMove event have very good sense: the event says that mouse pointer was moved and only adds information about all buttons that are pressed at the moment. For example, there can be both left and right mouse button pressed and ShiftState parameter can very well handle this, while Button argument of OnMouseDown and OnMouseUp specifies a single button that was just pressed/release at that moment.

Jiri

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Re: Issues with new OnMouse/OnKey events

Post by trixmoto » Mon Feb 02, 2009 9:42 am

I agree that as long as the event order is in the wiki then it doesn't matter what it is (as a web developer this is something that browsers often do differently so you have to be careful) and is probably best to stick with the underlying language rather than try and work against it.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

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

Re: Issues with new OnMouse/OnKey events

Post by ZvezdanD » Mon Feb 02, 2009 12:50 pm

ISDBUICommonEvents::OnKeyPress
Sub OnKeyPress(Key As String)

This event is called when a key is pressed.

Introduced in MediaMonkey 3.1.0.1221
Do this new event has a possibility to cancel input? Here is what we have with Visual Basic: "Keyascii is passed by reference; changing it sends a different character to the object. Changing keyascii to 0 cancels the keystroke so the object receives no character."

By the way (not related to this topic), it is nice that you added SelStart, SelLenght and SelText to the Edit and MultilineEdit controls, but it would be nice too if you add same properties to the Dropdown control which has a Style = 0. I really need them in my RegExp F&R script where I want to insert programmatically some text to the edit field of dropdown control where is a textual cursor.
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

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

Re: Issues with new OnMouse/OnKey events

Post by jiri » Wed Feb 04, 2009 11:27 am

No, it isn't possible to cancel the input here.

As for dropdown - ok, these properties will be added.

Jiri

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

Re: Issues with new OnMouse/OnKey events

Post by ZvezdanD » Wed Feb 04, 2009 4:50 pm

jiri wrote:As for dropdown - ok, these properties will be added.
Great! Thanks.
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