Scripting Image Buttons

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

Moderator: Gurus

Re: Scripting Image Buttons

Postby johnw3600 » Wed Jul 28, 2010 8:09 am

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

Postby johnw3600 » Thu Jul 29, 2010 6:33 am

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
johnw3600
 
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Postby ZvezdanD » Thu Jul 29, 2010 7:18 am

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.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export/Create Playlists for Child Nodes 4.0.4 (2013-08-03)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.2 (2013-08-31)  Find Currently Playing Track 1.3 (2013-11-09)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0.1 (2013-07-10)  Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2708
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Image Buttons

Postby johnw3600 » Thu Jul 29, 2010 7:45 am

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.
johnw3600
 
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Postby rovingcowboy » Fri Jul 30, 2010 4:13 am

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 viewtopic.php?f=9&t=16724 for some help check on Monkey's helpful messages at viewtopic.php?p=44008#44008 MY SYSTEMS.1.Xp pro sp3, vers 3.2 jukebox, pcchips mb. amd sem... built by me) 2.WinXP pro sp3, vers 2.5.5 and vers 3.2 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.WinXp pro sp 3 version 2.5 and version 3.2 work gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 4.Dell demension, winxp pro sp3, mm3.5 spare jukebox. 5.WinXp pro sp3, vers 2.5.5, moms computer. Sony vaio.)6. Samsung Galaxy Note2. Android 4.3
rovingcowboy
 
Posts: 13808
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)

Re: Scripting Image Buttons

Postby johnw3600 » Fri Jul 30, 2010 10:21 am

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.
johnw3600
 
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Postby rovingcowboy » Fri Jul 30, 2010 6:40 pm

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 viewtopic.php?f=9&t=16724 for some help check on Monkey's helpful messages at viewtopic.php?p=44008#44008 MY SYSTEMS.1.Xp pro sp3, vers 3.2 jukebox, pcchips mb. amd sem... built by me) 2.WinXP pro sp3, vers 2.5.5 and vers 3.2 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.WinXp pro sp 3 version 2.5 and version 3.2 work gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 4.Dell demension, winxp pro sp3, mm3.5 spare jukebox. 5.WinXp pro sp3, vers 2.5.5, moms computer. Sony vaio.)6. Samsung Galaxy Note2. Android 4.3
rovingcowboy
 
Posts: 13808
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)

Re: Scripting Image Buttons

Postby johnw3600 » Mon Aug 02, 2010 3:52 am

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
johnw3600
 
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Postby rovingcowboy » Mon Aug 02, 2010 8:38 am

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 viewtopic.php?f=9&t=16724 for some help check on Monkey's helpful messages at viewtopic.php?p=44008#44008 MY SYSTEMS.1.Xp pro sp3, vers 3.2 jukebox, pcchips mb. amd sem... built by me) 2.WinXP pro sp3, vers 2.5.5 and vers 3.2 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.WinXp pro sp 3 version 2.5 and version 3.2 work gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 4.Dell demension, winxp pro sp3, mm3.5 spare jukebox. 5.WinXp pro sp3, vers 2.5.5, moms computer. Sony vaio.)6. Samsung Galaxy Note2. Android 4.3
rovingcowboy
 
Posts: 13808
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)

Previous

Return to Addons developer forum

Who is online

Users browsing this forum: No registered users and 0 guests