Scripting Image Buttons

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

Moderators: Gurus, Addon Administrators

johnw3600
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Post by johnw3600 »

Thanks Zvezdan.

But in the case of using an Image object that simply has an OnClick event handler, perhaps there is no sense in which the image becomes 'active' so...

ax1.Interf.document.activeElement.id

is null.

It must be possible to identify the caller from within the Handler function. VBScripting knows which of four Handlers to use, so it must have a Caller id associated with that Handler, that should be readily identifiable within the handler routine.

So, for the time being, I have 4 event handlers ClickHandler_1 (etc) which immediately call a single routine ClickHandler(n) with the appropriate parameter. But is there a way of registering the event handler with a given parameter to parse???

[Edit: I've removed some rubbish I wrote here about not being able to set CurrentNode = unknownNode...
I just hadn't spotted a logic error!!]

Regards,
John
johnw3600
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Post by johnw3600 »

Thanks Zvezdan,

I did post a reply to this but it got lost in the ether when the MediaMonkey site got lost for a while!

ax1.Interf.document.activeElement.ID replies with an empty string!I suspect that this is because an image object doesn't go 'Active' even though it does fire the OnClick event! So something else is needed.

I tried innumerable variations on window.event.srcElement.tagName with no joy either.

For the moment I have 4 OnClick handlers (like ClickHandler_1 etc) each on which calls ClickHandler(n) immediately, so the code block only has to appear once. This works, but is not a really neat solution.

Since Script.RegisterEvent logs the event handler against the caller element in the panel, it must be possible to read which element threw the event, but I don't see how!
Or is this a limitation on VBScript? (its obviously not a MM issue)

Or, can you set up a value in Script.RegisterEvent to be parsed (not passed) as a parameter when the event fires? I already know you can't register a handler as: ClickHandler("this_one") !!!

Other than this issue of code compactness (which is what the above is really all about), I now have my Big Buttons working fine, with four of them taking you to MagicNode folders in the Tree, and four more sending the selected album tracks to each of said folders, by updating the Custom1 field in the SongList (called Source in this instance).

This works very well with a Touch Screen, when perpetually typing into the required field is tedious!
In short, you can categorize an album according to its 'Source' as follow...
One click on the 'Unknown' Source button to open that node in the Tree,
One click on the album art for an album in the TrackWindow display, and
One click on the 'SendtoStudio' button to catagorize this album as 'Studio' in the Custom1 (Source) field!
I would happily publish this in the Wiki, but I would rather sort the Handler issue (above) out first, as currently I have 8 handlers when 2 would do!

Regards,
John
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Image Buttons

Post by ZvezdanD »

johnw3600 wrote:ax1.Interf.document.activeElement.ID replies with an empty string!
This is because you have registered an event to a particular element of the Web page:
Script.RegisterEvent ax1.Interf.document.getElementByID(cap(i)), "OnClick", click

You need to register an event to the container document:
Script.RegisterEvent ax1.Interf.document, "OnClick", click

Please, take a look at Magic Nodes or RegExp Find and Replace source code. Both of them have Export/Import dialog box which contains Web browser control with an array of "buttons" in the # column and only one event handler subroutine for all of them.
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.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
johnw3600
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Post by johnw3600 »

Will do. Thanks.

BTW Is there anyway in MM where you can reduce the size of the Album Art as shown in the AlbumArt view of the Track Window. I need to see more albums at a time in my 'Jukebox'
I have looked in both the ini and 'theme' files of MM-Ultimate as well as all the options in MM and I can't find it anywhere!
Can I also remove the pop-up track list?

Cheers.
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Re: Scripting Image Buttons

Post by rovingcowboy »

no album art view size is set by program. and they set it to 100 pixels.

what popup track list?
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
johnw3600
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Post by johnw3600 »

Hmm, I think I will make a list of items that ought to come under Skin control (with a default in the program to keep old skins happy), and that's one of them. I go as far as to say that it seems amazingly silly that this is not already the case! :(

The 'Pop-up Track Information Display' which arrives with the MouseOver or OnClick event fired from the AlbumArt in the Track Window.
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Re: Scripting Image Buttons

Post by rovingcowboy »

oh i never seen that pop up list. it must be triggered by the mouse over but it might be the tool balloon that pops up.?

100 pixels is smaller then the icons in win7 or vista, both were made to be 128 x 128 at max size. xp can use those but if made for xp and vista they don't seem to be able to get as big as in win 7 for some reason.

maybe doing the 100 pixels size was also done so it will be uniform size in all the versions of windows. i know it can take up room on the screen when you have the tree and a lirycs window or album art window open too.
leaving very little for the listview area.
even more so when you are on a small screen res..

but the no album art image for use in the detailed view is controled by an image in the icons folder in the skins msz file.
maybe you can work with that direction some how? but it has to be 100 x 100 pixels. but you might be able to write a script that takes that image and vectors it down or up in size to show it in the album art with details view?

:-?
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
johnw3600
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Post by johnw3600 »

Thank for all the input.

Zvezdan, I had previously set just one RegisterEvent (not four) per ActiveX panel, but I then found...
id = ax2.Interf.document.activeElement.ID
...produced a blank ID.
But I was being stupid! :oops: I had given each Image an ID but not the image's <DIV> wrapper, so of course I was drawing a blank!
Now that works fine because I don't bother giving the image an ID just the <DIV>!
BTW Later I'll test whether indeed the image can be the ActiveElement if there is no <DIV> wrapper.

Keith, the fixed images I was a banging on about are in the Album Art view of the Main album/track window, and there the fixed size is much nearer 150px than 100 (and maybe more than that)!

Thanks again,
John
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Re: Scripting Image Buttons

Post by rovingcowboy »

well the album art view with details is shown in the listview area when you click the button to see it.
the no album art images used in there have to be 100 x 100 as far as i know because i tried bigger ones and they did not work.

:D
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
Post Reply