Quick Sign In:  

Forum: VirtualDJ Skins

Topic: Change button background to show play position

This topic is old and might contain outdated or incorrect information.

Hi there,

I'm still playing around with customising my own skin (based on the default skin) and I've come up against another problem:

I have added a number of buttons in a pop up panel to play the first 10 samples. Each button code is like this:


<button leftclick="sampler_default 1 & sampler_play_stop" rightclick="sampler_default 1 & sampler_play while_pressed">
<pos x="+6" y="+54"/>
<size width="200" height="20"/>
<off x="1642" y="1618"/>
<over x="1642" y="1644"/>
<text size="16" color="#C1C0C0" align="left" scroll="yes" action="get_text ' `get_sample_name 1`'"/>
</button>


The button works fine, but I would like to have the background "fill in" as it were, as the sample plays. Similar to how the browser background fills in as it scans for BPM etc.

Is this possible? Relatively easy?
I can't see how to do it with the button element. Do I have to use a visual element or something?

Thanks in advance

Steve
 

Posted Wed 13 Jul 16 @ 1:52 am
djdadPRO InfinityDevelopment ManagerMember since 2005
You will need a <visual source=""><off x="" y=""/><on x="" y=""/></visual> element placed after the <button> in your xml and use the action sampler_position X for source
e.g. <visual source="sampler_position 1">
 

Posted Wed 13 Jul 16 @ 3:55 am
Thanks DJDAD, but I must still be doing something wrong as it didn't work. I tried it this way:

<button leftclick="sampler_default 1 & sampler_play_stop" rightclick="sampler_default 1 & sampler_play while_pressed">
<visual source="sampler_position 1"><off x="1150" y="1475"/><on x="1150" y="1505"/></visual>
<pos x="+6" y="+54"/>
<size width="200" height="20"/>
<off x="1642" y="1618"/>
<over x="1642" y="1644"/>
<text size="16" color="#C1C0C0" align="left" scroll="yes" action="get_text ' `get_sample_name 1`'"/>
</button>


and this way:


<button leftclick="sampler_default 1 & sampler_play_stop" rightclick="sampler_default 1 & sampler_play while_pressed">
<pos x="+6" y="+54"/>
<size width="200" height="20"/>
<off x="1642" y="1618"/>
<over x="1642" y="1644"/>
<text size="16" color="#C1C0C0" align="left" scroll="yes" action="get_text ' `get_sample_name 1`'"/>
</button>
<visual source="sampler_position 1"><off x="1150" y="1475"/><on x="1150" y="1505"/></visual>


as I wasn't sure what you meant by "after the <button> element". But neither works :(

Any ideas?

Cheers
Steve
 

Posted Wed 13 Jul 16 @ 4:19 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
2nd one is the way you should go (so after the <button>...</button> element), but for the <visual>, you forgot to add <pos > and <size> ..it needs it, like all skin elements ;)
 

Posted Wed 13 Jul 16 @ 10:37 pm
Thanks DJDAD, I took your first post far too literally. My bad.

I had figured it out by trial and error, just before you posted your last reply, but thanks for confirming it.
I also had to move the <TEXT> out into a <TEXTZONE> element, or the visual overwrote the text.
All working like this for anyone else who has a similar issue:


<button leftclick="sampler_default 1 & sampler_play_stop" rightclick="sampler_default 1 & sampler_play while_pressed">
<pos x="+6" y="+54"/>
<size width="200" height="20"/>
<off x="1642" y="1618"/>
<over x="1642" y="1644"/>
</button>
<visual source="sampler_position 1" type="linear" orientation="horizontal" direction="right">
<pos x="+6" y="+54"/>
<size width="200" height="20"/>
<on x="1150" y="1505"/>
</visual>
<textzone>
<pos x="+6" y="+54"/>
<size width="200" height="20"/>
<text size="16" color="#C1C0C0" align="left" scroll="yes" action="get_text ' `get_sample_name 1`'"/>
</textzone>
 

Posted Thu 14 Jul 16 @ 3:27 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
<text> can take dy="X" to position text anywhere but the center
So you can still put the text back to the button and have something like..
<text dy="-15" ....
This will put the text 15 pixels above the center of the button.
 

Posted Thu 14 Jul 16 @ 4:13 pm
Thanks DJDAD, that's handy to know too, as it doesn't say that in the skin info.

I had to move the text out after the visual element though because the visual element came after the button in the XML, so when the sample was playing, it overwrote the text.

All done though now, so thanks for your help - you're s star!!
 

Posted Fri 15 Jul 16 @ 5:12 pm


(Old topics and forums are automatically closed)