快速登录:  

Forum: VirtualDJ Skins

话题: Using to produce different coloured buttons

由于该帖子已年深日久,可能包含陈旧过时或描述错误的信息。

alucasCUE userMember since 2008
Is it possible to <define> a <button> that has a different <on> position depending on whether it's used on the left or right deck? I tried this:

<define class="select_deck">
<pos x="+0" y="+0"/>
<size height="60" width="60"/>
<off x="96" y="2149"/>
<over x="226" y="2149"/>
</define>
<define class="select_deck_A">
<button class="select_deck">
<on x="161" y="2149"/>
</button>
</define>
<define class="select_deck_B">
<button class="select_deck">
<on x="294" y="2149"/>
</button>
</define>
but that didn't work. Perhaps you can't nest <defines> like this.
 

发表时间 Fri 27 May 16 @ 1:51 am
FruitPRO InfinityMember since 2003
like this :

<define class="select_deck" classdeck="left">
<size height="60" width="60"/>
<off x="96" y="2149"/>
<over x="226" y="2149"/>
<on x="161" y="2149"/>
</define>
<define class="select_deck" classdeck="right">
<off x="96" y="2149"/>
<over x="226" y="2149"/>
<on x="294" y="2149"/>
</define>

 

发表时间 Fri 27 May 16 @ 4:38 am
alucasCUE userMember since 2008
Thank you for that solution. It would be nice if there was a way of doing it without duplicating the data that is in common. For example, with your suggestion, if I want to change the size I have to remember to do it in two places.
 

发表时间 Fri 27 May 16 @ 9:15 am
FruitPRO InfinityMember since 2003
<define class="select_deck">
<size height="60" width="60"/>
<off x="96" y="2149"/>
<over x="226" y="2149"/>
</define>

<button class="select_deck"><on x="161" y="2149"/></button>

<button class="select_deck"><on x="294" y="2149"/></button>


You can also do it like this but :

In the first example it's usual to put the two buttons's code at the same place in your xml (let's say in a "buttons" group), whereas in this 2nd example, the buttons will belong to <deck> beacons or some panels that could make them far from each other (and so more difficult to modify later).
 

发表时间 Fri 27 May 16 @ 10:40 am
You can't nest definitions.

However, there are ways to overpass this depending on what you want to achieve.

The most common way is to override an attribute when you call it:
DEFINITION:
<define class="selectdeck" action="select" >
<pos x="+0" y="+0"/>
<size height="60" width="60"/>
<on x="96" y="2149"/>
<off x="96+60" y="2149"/>
<over x="96+60+60" y="2149"/>
</define>

CALLS:
<button class="selectdeck" deck="1"/>
<button class="selectdeck" deck="2"><on x="96+60+60+60" y="2149"/></button>


PS: Generally when defining items it's a good idea to hold them together when you use classdeck:

<define class="bt_PFL" action="pfl" rightclick="select" classdeck="1">
<size width="32+4" height="17+4" />
<pos x="+0" y="+0"/>
<up x="1515" y="1450"/>
<mouserect x="+0" y="+0" width="32" height="17"/>
<text width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" color="#808080" weight="bold" format="PFL" />
<textselected width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" weight="bold" color="#008ce1" format="PFL" />
<tooltip>Select this deck to prelisten \non headphones</tooltip>
</define>
<define class="bt_PFL" action="pfl" rightclick="select" classdeck="2">
<size width="32+4" height="17+4" />
<pos x="+0" y="+0"/>
<up x="1515" y="1450"/>
<mouserect x="+0" y="+0" width="32" height="17"/>
<text width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" color="#808080" weight="bold" format="PFL" />
<textselected width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" weight="bold" color="#e60000" format="PFL" />
<tooltip>Select this deck to prelisten \non headphones</tooltip>
</define>
<define class="bt_PFL" action="pfl" rightclick="select" classdeck="3">
<size width="32+4" height="17+4" />
<pos x="+0" y="+0"/>
<up x="1515" y="1450"/>
<mouserect x="+0" y="+0" width="32" height="17"/>
<text width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" color="#808080" weight="bold" format="PFL" />
<textselected width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" weight="bold" color="#28c800" format="PFL" />
<tooltip>Select this deck to prelisten \non headphones</tooltip>
</define>
<define class="bt_PFL" action="pfl" rightclick="select" classdeck="4">
<size width="32+4" height="17+4" />
<pos x="+0" y="+0"/>
<up x="1515" y="1450"/>
<mouserect x="+0" y="+0" width="32" height="17"/>
<text width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" color="#808080" weight="bold" format="PFL" />
<textselected width="32-4" height="17" dx="+2" dy="+0" size="12" align ="center" scroll="no" weight="bold" color="#ffd700" format="PFL" />
<tooltip>Select this deck to prelisten \non headphones</tooltip>
</define>

This way it's easier to handle. And when you do changes you just copy/paste them on rest defines
 

发表时间 Fri 27 May 16 @ 10:44 am
alucasCUE userMember since 2008
OK - thanks for your help.
 

发表时间 Sat 28 May 16 @ 1:26 am


(陈旧帖子或论坛版块会自动关闭)