Skip to main content
Topic: 'Seekbar' background for selected track (Read 2073 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

'Seekbar' background for selected track

I have seen a few people with quite a nice feature on their playlists - When a track is selected, there is a seekbar in the background of that selection. I'm assuming that this 'seekbar' isn't actually clickable, but actually just a rectangle drawn with a width depending on the progress of the track. I have tried to do this on mine too, but unfortunately I haven't got it to work, so can somebody help me to debug this code please?...

Here is the code for the item display: (just the default SCPL item display modified for this)

Code: [Select]
$if(%_selected%,$drawrect(0,0,0,0,brushcolor-SYSCOL-13 pencolor-null))

[color=#FF0000]// PerSecond
$drawrect(0,0,0,0,brushcolor-SYSCOL-13 pencolor-null)
$drawrect(1,1,$eval(( %playback_time_seconds%/ %length_seconds%)*%_width%),$eval(%_height%-2),brushcolor-0-0-0 pencolor-null)

$drawrect(0,0,%_width%,1,brushcolor-null pencolor-null)


Seems to me that ([time passed]/[total track time] ) * [width] should be reasonable to acheive this, so I'm not sure whats wrong. So how is this actually done then? 

Thanks for any help

'Seekbar' background for selected track

Reply #1
Credits to Brumal:

Put this in your $if(%isplaying%,... conditional statement.

Code: [Select]
            $drawrect(Xoffset,Yoffset,$get(progress),$sub(%_height%,8),brushcolor-0-0-0 pencolor-0-0-0)

The $sub(%_width%,70) defines the length on the rectangle when %_time_remaining% is 0.

EDIT: I just saw your code and it is right and I'm not sure whats wrong. :/
EDIT 2: Err I think you just need to put in %isplaying% rather than %_focused%

'Seekbar' background for selected track

Reply #2
Thanks I tried to put %isplaying% instead but that didn't work.
I replaced my statement with yours, and it works so you were right in the first place  , but the alignment of the rectangle is a bit off - that should be easily fixed though.


EDIT: Sorted it now^^ just changed x and y offset to 1,1 instead. Looks really good too, I'm going to try it out with some images now instead of rectangles.

'Seekbar' background for selected track

Reply #3
Oh! I think yours didn't work because the the division created a decimal number. $muldiv rounds to the closest integer while the "/", I think, doesn't round it off.

SimplePortal 1.0.0 RC1 © 2008-2020