Page 1 of 1

How to create a checkbox list?

Posted: Mon Sep 24, 2018 10:15 am
by nidrig
hi,
I need to create a checkbox list to show/hide hotspots groups.

Coming from krpano, I used to create a checklist programmatically, which was a breeze.

Now, with pano2vr, I'm a bit confused.

What I've figured out:

- I need to create all the list manually; each checkbox and text entry one by one
- I need to create one checkbox for each entry; and change a variable (checked/unchecked) on mouse click (and of course hide/show the hotspots accordingly) and also turn the tick image on/off

It seems a lot of repetitive work. Is there a way to create a sort of "generic" (component) checkbox that I can reuse?
If someone could give me some directions/advices to create this, it would be very welcome!

Btw, I'm using v6b4 (pro).

Re: How to create a checkbox list?

Posted: Mon Sep 24, 2018 11:15 am
by Hopki
Hi,
You would use a variable.
• Open the skin editor and select a blank area so you see the variables list which is laid out like a table, this will be empty with a new skin.
Double click in the Name cell, select the default text var1 and rename it, example hotspot_nav. Set type to true/false and int value to true, I'm going with hotspots should be visible at the start, the init value can be changed at any time in the variable list.
Repeat the above until all your hotspot types have been addd to the variable list.

Using the above example variable, hotspot_nav.
• In the Navigation Hotspot Template add a visible logic block and then select Trigger => Variable => *hotspot_nav.
The logic block now has the variable under the trigger heading. Leave the Comparison to =.
Set the value to false and then Visible false.

• In the skin add your button/check box.
It needs the action: mouse click, set variable value, hotspot_nav, Not(¬). The operation Not(¬) will toggle the state of the logic block between true and false.

As you select the button/check box the variable state will change thus hiding the hotspot template.
Knowing you have a variable switching between true and false you know have "options".
You can also copy and past the button/check box with only having to change the variable it is changing.

Example,
Have two graphics stacked on top of each other, one an empty check box and other with a tick.
They can have visible logic blocks that will use the variable, when hotspot_nav is true check box with tick visible and check box without hidden.

You can then copy the above button/check box and paste as many times as required. You then only had to go back in and change which variable it will react to.

Or a text box can have a text logic block with text, again if the hotspot_nav variable is true you can display the text "Click to hide hotspots". And when false "Click to show hotspots".
The text box can even have the action to toggle the variable.

Where there is a lot of repeats you should find that there is a copy function, be it a logic block or action in the skin.
We also allow multiple elements selected and paste to all in one click.
Once your used to this way of thinking then this will speed up your workflow.

Regards,
Hopki

Re: How to create a checkbox list?

Posted: Tue Sep 25, 2018 9:23 am
by nidrig
Many thanks for the detailed answer! It works like a charm!

I just need to rewire my coder brain, now :D