Scripting Image Buttons

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

Moderator: Gurus

Scripting Image Buttons

Postby johnw3600 » Sun Jul 25, 2010 8:01 pm

Hi again,

So, I've got going in creating a kind of Big Button interface when using MM with Magic Nodes as a Jukebox for playing our huge studio CD collection on a Carillon rackmount PC with an ELO Touchscreen! As soon as you start using a touchscreen you see the need for a big button affair, as fingers are too clumsy even at 800x600 res.

But how do I script buttons (or forms or panels or anything) to have an image surface?
Is this only by adding the images to several instances of some new button class in the Theme definition of a 'Skin', and instantiating this class from within my Auto Script?
This is starting to look complex! Are there any examples I can crib?

In short, can I not define and new button in my Auto Script and just give it an image property???

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

Re: Scripting Image Buttons

Postby rovingcowboy » Mon Jul 26, 2010 4:37 am

adding buttons to the player is done in the skinning theme engine.

just what buttons you talking about i'm not sure but the ones in the button container i think can be made larger by making the window header larger then making the container larger then make the buttons larger they are all coded in the theme engines right column code for each single object.

you dont really have to make a larger button image just an image that looks good when stretched. then you set both the border and the image codes to stretch the image. this will of course only work when you use the code in the ini file for the player. but i think it works automaticly with the buttons on the window's headers.

but as you can guess making the headers bigger will take up more of your screen space so this should only be done in skins that have been made for use only on huge screens.

is that of any help to you.
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.4) 7. Proscan tablet Android 4.3 )
rovingcowboy
 
Posts: 13879
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)

Re: Scripting Image Buttons

Postby johnw3600 » Mon Jul 26, 2010 6:15 am

Thanks for the reply. It goes someway towards resolving my problem by confirming that I can only put an image on a button face by Skinning. So I presume there is no vbscript object whereby I can go...

Set obj = SDB.UI.NewObject(panel)
obj.Image.src = "C:\Program Files\MediaMonkey\Images\myimage.jpg"

(or anything similar!)
So I have to work on skins, right?

But I do not want all the required Buttons to have one generic face, instead I want to use buttons as if they were large Toolbar icons, but not on a menu or toolbar - and certainly without enlarging the existing menu bars or Tree text or toolbars.
Instead the plan is to have a dockable panel (actually more than one eventually) with several large buttons on the panel, each with its registered OnClick function.

Now, I'm working (or walking) my way through your 'Fast Newbie's Skinning Walkthrough' [thanks hugely] and I see how to edit images, such as the Face of a general button. I see that you can create new Objects within ThemeEditor, and I can see that some objects are referenced in the .ini files of the skin. But, I am puzzled, and left with questions...

1. Does simply creating an object in ThemeEditor, bundling that in the skin, and referencing it in the .ini, register the object in MM when that skin is applied, so that you can Instantiate that object type in an Auto Script?

2. Is so, how do you instantiate the new object?

3. Do you use ActiveBitmap objects for this?

4. Does this mean that there is no way of creating new buttons on the fly in an Auto Script, using a 'Buttons' table added to the MM.DB database that has the path & filename of the button image, so that more can be added?

5. Is the spelling of Transparent ('Tranperent') in the MM_Ultimate skin's .ini files significant, or just a mistake left un-noticed?

Regards,
John

[Whoops! :oops: I've just found the wiki pages on ThemeEditor which again goes part-way to answering my questions, but I would still apreciate comments, as all five still need clarity. Cheers]
johnw3600
 
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Postby ZvezdanD » Mon Jul 26, 2010 7:09 am

johnw3600 wrote:So I presume there is no vbscript object whereby I can go...

Set obj = SDB.UI.NewObject(panel)
obj.Image.src = "C:\Program Files\MediaMonkey\Images\myimage.jpg"

I asked MM developers so many times before for such thing, but without any response.

I think your only solution could be to use WebBrowser ActiveX. I have such thing with the Icon control in my RegExp Find and Replace script:
Code: Select all
Set wbIcon = SDB.UI.NewActiveX(frmDialog, "Shell.Explorer")
wbIcon.Interf.document.body.innerHTML = "<img src=""" & sIconFileName & """>"
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: 2754
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Image Buttons

Postby rovingcowboy » Mon Jul 26, 2010 7:14 am

as i said i'm not sure if those were the buttons you wanted i was talking about.
it seems ZvezdanD has found your answer for you. as i see you mentioned auto scripts.
those are just scripts nothing to do with the skinning.
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.4) 7. Proscan tablet Android 4.3 )
rovingcowboy
 
Posts: 13879
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)

Re: Scripting Image Buttons

Postby johnw3600 » Mon Jul 26, 2010 7:37 am

Thanks to both of you for replying, I guess it looks like ActiveX objects as ZvezdanD suggests, though I had not thought of considering webbrowser objects within the MM interface!

But, (regard me as a bit dense) are we saying that objects created in a skin cannot be referenced or used in a script??? Am I more confused still?


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

Re: Scripting Image Buttons

Postby trixmoto » Mon Jul 26, 2010 8:00 am

ZvezdanD wrote:I asked MM developers so many times before for such thing, but without any response.

Have you added this to Mantis? I know there are lots of new scripting features coming to MM4 (some of which I'm very excited about, cos I'm a geek!) but I don't know if this is one of them.
Download my scripts at trixmoto.net. If you're interested, check out my Uniface blog.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Image Image
trixmoto
 
Posts: 9961
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK

Re: Scripting Image Buttons

Postby ZvezdanD » Mon Jul 26, 2010 8:35 am

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: 2754
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Image Buttons

Postby johnw3600 » Mon Jul 26, 2010 1:07 pm

Sorry folks, but I still don't get it!

There is still something fundamental I can't get my head round!
Yes, I know understand that you can't create button objects (or the equivalent) and change their image source on the fly - unless you do something with ActiveX objects.

But surely, as I am now willing to settle for creating four new fixed button objects in ThemeEditor and fix a different image on each, I must then be able to get at them in Auto or Normal scripts from within MM. Otherwise how could you make a player interface that works???

Or are we saying that the only objects recognised in such scripts are those predefined in MM, not others defined in a skin??? If so what are the .ini files doing?

As for ActiveX I cannot make that work without a better tutorial or at least an Object Reference table. Is there more complete information anywhere??? All I have seen so far suggests that the ActiveX approach clunks!
johnw3600
 
Posts: 13
Joined: Thu Jul 22, 2010 2:44 pm

Re: Scripting Image Buttons

Postby ZvezdanD » Mon Jul 26, 2010 2:26 pm

johnw3600 wrote:Otherwise how could you make a player interface that works???

Or are we saying that the only objects recognised in such scripts are those predefined in MM

Forget about skinning, don't waste your time with it, that is the dead end. Buttons from the Player has nothing in common with the buttons from the scripts. MM API has just one button object that could be used in dockable panels: http://www.mediamonkey.com/wiki/index.php/SDBUIButton and that object doesn't support Image property.
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: 2754
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Image Buttons

Postby Peke » Mon Jul 26, 2010 9:24 pm

Zvezdan you are right. No image Button.

I guess I was not sure how to understand http://www.ventismedia.com/mantis/view.php?id=6336 but now when you mentioned it along with http://www.mediamonkey.com/wiki/index.php/SDBUIButton looks more clear.

Can you write me a PM so that we can see how to make framework for it as Delphi itself do not have Picture button object that can be used but BitButton without caption and Icon can be possibly used to represent button.
Best regards,
Pavle
MM Core Developer and Admin of free MediaMonkey extensions Hosting
Image
Image
Peke
 
Posts: 8200
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia

Re: Scripting Image Buttons

Postby johnw3600 » Tue Jul 27, 2010 5:23 am

Thanks Zvezdan,

I simply had not grasped the import of a statement like:
Whether and how these skin objects are used totally depends on the implementation of the MediaMonkey Theme Engine

in the wiki under Theme Editor!

And Peke now I know you're coming from Delphi, I can see why buttons don't have an accessible Image property; at least TBitBtn objects have an accessible Glyph as well as Caption (either of which are then optional).

Ho Hum, It is ActiveX for now then!

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

Re: Scripting Image Buttons

Postby ZvezdanD » Tue Jul 27, 2010 7:10 am

Peke wrote:I guess I was not sure how to understand http://www.ventismedia.com/mantis/view.php?id=6336 but now when you mentioned it along with http://www.mediamonkey.com/wiki/index.php/SDBUIButton looks more clear.

Can you write me a PM so that we can see how to make framework for it as Delphi itself do not have Picture button object that can be used but BitButton without caption and Icon can be possibly used to represent button.


You are joking about Delphi lack of buttons with pictures, aren't you? I could send you my Delphi sources with a bunch of buttons with pictures. MediaMonkey itself has buttons with pictures in many places, e.g. up, down and delete buttons beneath of Options > Library > Filters & View or several buttons in the Track Properties dialog box. We don't need anything more then that, we need just same buttons as MediMonkey has.

By the way, here is a part of my old related message: Very serious problems with some scripting functions by ZvezdanD on Sun Dec 28, 2008 1:43 pm
"Listbox and Dropdown controls could have a property to assign icon/picture to every item in the list (something like Owner Draw Combo and List box controls in some languages). Buttons also could have a property to assign a icon/picture to them, with a possibility to decide if it should be displayed together with the caption or without it, and with the property to specify a relative position to caption - e.g. left to caption or above the caption."
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: 2754
Joined: Thu Jun 08, 2006 7:40 pm

Re: Scripting Image Buttons

Postby johnw3600 » Tue Jul 27, 2010 1:11 pm

Woh-hay!!!! :D :D :D

I now have my line of four lovely bright shiny image buttons, courtesy of ActiveX. Thanks Zvezdan, for forcing me to go there! These buttons aren't 'button objects' at all, they are just 4 HTML 'images' with OnClick events registered to each, all sitting in an ActiveX web browser object, which itself is in an oridinary vb panel.

They work beautifully, calling back to the vbscript on click.
I'm particularly pleased with...

Code: Select all
 html = ""
  for i = 1 to 4
     style = "style='border:1px;width:48px;height:36px'"
     html = html & "<img id='" & cap(i) & "' src='" & path & src(i) & "' " & style & " alt='" & cap(i) & "'>"
  next
  ax1.Interf.document.body.innerHTML = html
  for i = 1 to 4
    click = "ClickHandler_" & cap(i)
    Script.RegisterEvent ax1.Interf.document.getElementByID(cap(i)), "OnClick", click
  next

[Obviously the 'cap' and 'src' arrays and the ax1 object were defined higher up]

Later I will space the objects as I wish, with a table I expect so they float better if the dockable panel is stretched.

But I still have one question (aside from agreeing that you can do what the heck you like in Delphi so long as you accept that objects like TButton are a bit plain out-of-the-box)...

Q: How do I indentify the Sender of an OnClick event?
All four ClickHandler routines could be one, so long as I know the 'id' of the image object.

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

Re: Scripting Image Buttons

Postby ZvezdanD » Tue Jul 27, 2010 3:43 pm

johnw3600 wrote:Q: How do I indentify the Sender of an OnClick event?
All four ClickHandler routines could be one, so long as I know the 'id' of the image object.

I suppose that you need something like this:
Code: Select all
Select Case ax1.Interf.document.activeElement.ID
Case cap(1)
...
Case cap(2)
...
End Select
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: 2754
Joined: Thu Jun 08, 2006 7:40 pm

Next

Return to Addons developer forum

Who is online

Users browsing this forum: No registered users and 0 guests