Quick Sign In:  

Forum: VirtualDJ Skins

Topic: Issue with using variables to toggle pannels

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

SupaconPRO InfinityMember since 2005
Sometimes when you have two pannels, it seems a little silly to have two buttons to switch between them, when one button to toggle would be plenty fine. With VDJScript, that can be done.

For instance, my skin has the following code:

<button action="toggle $wave_separate & var $wave_separate ? skin_pannel 'wave_separate' on : skin_pannel 'wave_overlay' on">
<size width="104" height="35"/>
<pos x="1297" y="4"/>
<selected x="+0" y="+1550"/>
<down x="+0" y="+2042"/>
<over x="+0" y="+2534"/>
<downselected x="+0" y="+3026"/>
</button>


It toggles a pannel between two states, which works fine, but it has the following issue:

If the user sets the non-default mode (Separate), then exits the program, the $waveopt_on variable gets reset, but the skin remembers the pannel mode.
This results in the button showing the wrong state, until it gets clicked, which then sets the variable correctly, and makes it match.

How can this issue be solved?

Is there a way that the variable can be set or initialized based on the status of the pannel?
Can VDJ be made to store or remember the variable somewhere for the next time it gets loaded?

Some advice with this would be appreciated.
 

Posted Sun 02 May 10 @ 7:21 am
cstollPRO InfinityMember since 2004
 

Posted Sun 02 May 10 @ 9:08 am
SupaconPRO InfinityMember since 2005
Thanks Chris. I had a look, but I don't think it's quite what I'm looking for.

One possibility I have considered was that if it were possible to set the variable based on which pannel is active, that would allow me to resolve this. I don't know if it's doable though. I'll mess around and see what happens, I guess.
 

Posted Sun 02 May 10 @ 12:35 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
You can do it without variables

Lets say you need 3 buttons to change 3 pannels. (pannel1, pannel2, pannel3).
Make 3 more pannels (pannel switch1, switch2, switch3) and put inside 1 button.
Each time the up pannel action will show the active pannel. Pressing the button will cycle through the pannels and changing the button appearence.

I have done something similar with pitch & key pannels in my Rusty Skin. Buttons are in the pannels, but as i mentioned you can create other pannels to place them somewhere else. Take a look.

Good luck skinners.
 

Posted Sun 02 May 10 @ 1:46 pm
SupaconPRO InfinityMember since 2005
Thanks for the tip DJDad...

It took me a while to wrap my head around what you are saying, but basically in this case, the button to switch the pannel actually is *in* the pannel, right?

I never thought of doing it that way! I can actually make that work in my scenario, although at first I didn't think it made sense. My buttons are just off the edge of the pannel, but I should be able to put a bunch of other stuff in with the pannel to make it fit. I'll give it a go!

Er... no, wait... I think I see a better solution. You were saying to make the button itself in a SEPARATE pannel that you can have change along with the pannel that it changes. Got it... I think that makes more sense.
 

Posted Sun 02 May 10 @ 2:14 pm
SupaconPRO InfinityMember since 2005
Okay, cool, I think I made this work well just as a test.

There was one issue, however:

I had to change the selected state of the buttons to use the down state graphics:
The reason for this is that it doesn't make sense to show selected state, because when it actually gets selected, the button has already changed to show a different button for something irrelevant already.

Because the pannel switch takes place as soon as the mouse clicks, you never actually would see the down state normally.

But simply using the down graphics for the selected state, this actually does work around this problem and usually briefly shows a down state, giving a visual confirmation of the button being clicked.

I think this should work very well!
 

Posted Sun 02 May 10 @ 2:43 pm
djdadPRO InfinityDevelopment ManagerMember since 2005
No you dont need to have those buttons IN the pannels. Simply create 3 more NEW pannels..

Example.. Lets say you want to cycle through pannels A, B and C

You want the buttons to be outside somewhere else. Create 3 pannels lets say BUT1, BUT2 and BUT3

The code should look like this..

pannel="BUT1" action="skin_pannel 'B' on & skin_pannel 'BUT2' on"

pannel="BUT2" action="skin_pannel 'C' on & skin_pannel 'BUT3' on"

pannel="BUT3" action="skin_pannel 'A' on & skin_pannel 'BUT1' on"


...and yes it's the down element you have to use.
 

Posted Sun 02 May 10 @ 4:40 pm
SupaconPRO InfinityMember since 2005
Oh, yeah, I figured out what you meant, and I've already implemented it.


Thanks for your help!
 

Posted Sun 02 May 10 @ 4:41 pm


(Old topics and forums are automatically closed)