Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: 'Toggle button' using PVAR's. (Read 5742 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

'Toggle button' using PVAR's.

Hi, I haven't posted here in a while, hope everyones well  , and I've got a question:

If I create a button using the $button2() function and give it the command to set a PVAR, it is only evaluated when there is no track playing, but not when a track is playing. I am fairly sure this has something to do with it being under a // PerTrack header - but buttons will only function properly under that header anyway so that is quite a predicament.

The button I have made is actually a toggle button using the code:

Code: [Select]
$button2(---example---,PVAR:SET:mem1:$ifgreater($getpvar(mem1),0,0,1),)

And using the following to return the PVAR (I'm actually evaluating this in a track display, and not as part of my main config, but I wont post up all the code):
Code: [Select]
$getpvar(mem1)

Before anyone says it, I have only declared the PVAR once in the code, using the above button command. Also I don't think the result would be any different if it were just setting a PVAR normally (without the toggle).

NB:I should note that I did make a similar post a while ago, but as that was quite a while ago, and was full of my long tedious code and questions, I thought it best to make a new thread instead. (Not sure where the forum admin etc stands on this, so sorry If I got it wrong to make another  )

Anyhow I never did really find a solution to my problem despite having had the help of a couple of more experienced members of this forum so I'm crying out for help again now that I've found the root of my problem, (which was actually quite unspecified in my previous thread). Also I'm not sure if any of the issues that I had previously have been resolved in any newer versions of panels UI etc, as I'm not really up to date with it all.

Right, thanks for your time, and hope you can help. 

-mac

'Toggle button' using PVAR's.

Reply #1
Are you using the code inside a %_isplaying% function?
Try putting the button code after the "// PerTrack" line

'Toggle button' using PVAR's.

Reply #2
Are you using the code inside a %_isplaying% function?


I'm using it in on the parameter of %_trackinfo_notrack%.

For the // PerTrack header I have already placed the button2() under it. This is the code of my track display if you want to see it (I have basically edited the default track display, just to debug this code):

Code: [Select]
$drawrect(0,0,%_width%,%_height%,pencolor-0-0-0 brushcolor-0-0-0)
$padding(2,4)$align(center,top)$font(,13,glow-200-247-60,SYSCOL-8)
$if(%_trackinfo_notrack%,
    No Track $getpvar(mem1)
,
    %title% $getpvar(mem1)$char(10)
    $font(,9,bold,255-255-255)%artist%$char(10)
)

// PerTrack
$button2(---example---,PVAR:SET:mem1:$ifgreater($getpvar(mem1),0,0,1),)


(edited out the rest of the button because it was too long, but that is all fine)

'Toggle button' using PVAR's.

Reply #3
Post all the code. Use codebox instead of code.

'Toggle button' using PVAR's.

Reply #4
Post all the code. Use codebox instead of code.

OK I will post the PUI as well just for completeness, although its nothing big, because I'm just testing things out in a new PUI.

PUI:
Code: [Select]
$panel(playlist,Single Column Playlist,0,0,%_width%,$sub(%_height%,20),)
$panel(trackinfo,Track info mod,0,$sub(%_height%,300),%_width%,280,)
$panel(buttons,Buttons,0,$sub(%_height%,20),%_width%,20,)


Track info:
Code: [Select]
$drawrect(0,0,%_width%,%_height%,pencolor-0-0-0 brushcolor-0-0-0)
$padding(2,4)$align(center,top)$font(,13,glow-200-247-60,SYSCOL-8)
$if(%_trackinfo_notrack%,
No Track $getpvar(mem1)
,
%title% $getpvar(mem1)$char(10)
$font(,9,bold,255-255-255)%artist%$char(10)
)

// PerTrack
$button2($sub($div(%_width%,2),$div($calcwidth(Library),2)),$sub(%_height%,$div(%_height%,5)),5,5,$add($calcwidth(Library),10),$add($calcheight(Library),10),'$font(Arial,10,,255-255-255) Library','$font(Arial,10,,255-0-0) Library',PVAR:SET:mem1:$ifgreater($getpvar(mem1),0,0,1),)

The button toggles properly when there is no track, but not if a track is playing.

'Toggle button' using PVAR's.

Reply #5
The code is fine.
Try dowloading the latest version of Panels UI
and replace "Trackinfo mod" with "Track Display" in $panel

'Toggle button' using PVAR's.

Reply #6
OK, I thought it was all correct, so it must be something that is not supported by my foobar for whatever reason.

I will give it a try and get back to you. Can you link me the download for the latest version please?

Thanks.
-mac


'Toggle button' using PVAR's.

Reply #8
http://panels.fooblog2000.com/

Remember you must delete "trackinfo mod" and "single columns playlist".


Just tried it out and it worked.

So I deleted the Track info mod.dll, and I'm using Track Display now for the panel name. This track display has all of the same functionality as Track info mod as well so thats good. It's now built into panels UI then?

Thanks alot for your help Cepiperez