Dynamicly Generated Buttons in Panel?

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Dynamicly Generated Buttons in Panel?

Re: Dynamicly Generated Buttons in Panel?

by Just Guessing » Tue Sep 11, 2012 9:29 am

PROBLEM HAS EVOLVED: Man, I got lots of trouble when for a while NOTHING seemed to work. Then I came to a point where line 1 below didn't work but line 2 did!

Code: Select all

   ... <img src='" & strAlbumArtFile & "'> ...
   ... <img src='" & strAlbumArtFile & "'> ...
See the difference?? How could you; but at some point I copy/pasted some snippet somewhere and the space after the first 'img' is NOT a space but '/xe0' character. It spread like a virus too. What a waste of hours!

------- anyway -------------

Alright, someone be a script hero and help me with this last leg here! I'm begging!

I have a panel (very stripped/core version of the MMonkey SongInfoPanel script). The panel is drawn in HTML.

I have two buttons in the HTML which pass a variable to a sub so - when a button is pressed the Custom4 tag gets the variable written to it.

This works, but isn't handled right, as BOTH BUTTONS WRITE THE VARIABLE 'SubGenre222'.

Code: Select all

Doc.Add " <HTML><HEADER></HEADER><BODY>... etc

Doc.Add " 	<BUTTON NAME='button1' Onclick=" & writeCustom4(SubGenreOne) & ">First button</button>"
Doc.Add " 	<BUTTON NAME='button2' Onclick=" & writeCustom4(SubGenreTwo) & ">Second button</button>"

...

Function writeCustom4(xxx)
  '	Dim SDB
  '	Set SDB = CreateObject("SongsDB.SDBApplication")
	Dim nowsong
	Set nowsong = SDB.Player.CurrentSong
	nowsong.Custom4 = xxx
  '	Dim list
  '	Set list = SDB.NewSongList
  '	list.Add(nowsong)
  '	nowsong.UpdateAll
  '	list.UpdateAll 
  '	Set list = Nothing
  '	Set SDB = Nothing
  '	Set nowsong = Nothing
  '	Set SubGenreOne = Nothing
  '	Set SubGenreTwo = Nothing
End Function
If problem 1 gets fixed, then will have to figure out the proper way to write the tags. Without the commented out bits of the function above, the tags dont stick. Reopen mMonkey, they're gone. BUT with them uncommented, the tags were being written when a song changed, without any button pressing. Do I need a routine to check for the event?

Code: Select all

"If IsObject(xxx) = True Then"
or something? -- Thank You.

Re: Dynamicly Generated Buttons in Panel?

by Just Guessing » Thu Sep 06, 2012 9:53 am

OK, some aspects of progress already; so a more specific request For aid:

I've Created a BUTTON Inside a SongInfoPanel script funtion.
SongInfoPanel uses HTML In this Function To draw the panel. Executed like this:

Code: Select all

Doc.Add " <INPUT TYPE='Button' NAME='SubGenreTag1' VALUE=" & SubGenre1 & ">"
The variable SubGenre1 gets a refreshed value based on the now playing song's GENRE tag. Working!
But I can't get the button to do any tag writing (specificly, write the SubGenre1 value to Custom3).

Tried this in the function:

Code: Select all

Script.RegisterEvent Doc, "OnClick", "SubGenreTag1" ...
Tried this outside the function:

Code: Select all

Sub SubGenreTag1_OnClick(). . .
Does the Doc.Add aspect not permit true button functionality, Or something ?
I do like the button being an aspect of HTML as it will be nicely CSS'd in the end (I'm good with CSS).

Re: Dynamicly Generated Buttons in Panel?

by trixmoto » Thu Sep 06, 2012 2:28 am

You need to use an OnPlay event.

Re: Dynamicly Generated Buttons in Panel?

by Just Guessing » Wed Sep 05, 2012 12:20 pm

Is there any part of it in particular that you are struggling with?
Err...all of it.

Well not exactly; I have succesfully gotten buttons (which write to desired tags); I've gotten the buttons to correctly handle multi-value entry; I've even gotten toolbar buttons going to show or hide the button's panel! And I am brand new at this stuff, so its VERY exciting to personalize my music interface this way.

But the REFRESH aspect, when the song changes, and the dynamic caption (which will be the tag) for the button; that's code I think I've seen but I cant understand what's at work.

I tried to 'hack' SongInfoPanel for experimentation (since it refreshes with new song changes), I was even able to get HTML buttons into its display that wrote to my tags [EDIT: wrong, I got vbs button outside of the HTML that wrote to the tags].
But the refresh/dynamic side wasn't there no matter what I tried.

I spent a long time trying, and finally thought I'd start by asking the knowlegable if it is even possible.

Re: Dynamicly Generated Buttons in Panel?

by trixmoto » Wed Sep 05, 2012 3:33 am

Yes, it's definitely possible to do this. Is there any part of it in particular that you are struggling with?

Dynamicly Generated Buttons in Panel?

by Just Guessing » Tue Sep 04, 2012 9:15 am

UPDATE: panel with VBS buttons working great. Never got HTML buttons to work right. I thought I'd prefer those, but its all good at this point. Case closed.

TOUCHSCREEN + MUSIC = EXCELLENCE
TOUCHSCREEN + RtClk/MENUs = nuisance
TOUCHSCREEN + well-sized BUTTONS = the FUTURE

So I'm marrying tagging to panels with buttons, and I'm lovin it (©McDonalds Corp).

????????????????????? Is THIS possible: ?????????????????????

------------------- Dynamic buttons -------------------

So if the newly playing song's GENRE = LATIN.
a panel refreshes with a few predetermined buttons for BOOGALOO, SALSA, MAMBO
Pressing the button enters the buttons caption in a custom field for SUBGENRE.

I can think of several genres that would be WILDLY more useful in a 'more inclusive parent/more specific child' breakdown. I tried all night but couldn't get a hint if this is possible. I certainly don't know how to work the code. Thanks!

Top