Multi-state Button

Post Reply
UrbanCyborg
Posts: 599
Joined: Mon Nov 15, 2021 9:23 pm

Multi-state Button

Post by UrbanCyborg »

Put succinctly, is there a native way in VMD to implement a multi-state button, which is to say, a button with more than two states, and a different appearance for each state? Either style of button only has two states, and overlaying button graphics on a multi-way switch would match the graphics, but not the functional semantics. This seems a simple enough thing, but I can't see any way to easily do it, short of simply defining all the mechanism of a new type, and I'm not sure such a thing could be brought within VMD's database of native types. If anyone knows better, please weigh in.
Cyberwerks Heavy Industries -- viewforum.php?f=76
User avatar
seal58
Posts: 354
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: Multi-state Button

Post by seal58 »

I just did this in a new module. There are two toggle buttons grouped as radio buttons. Each has two states. For a special mode I used toggleButton.SetVisible(false) to dissappear and toggleImage.SetVisable(true) at same position in order to get a third state for each toggle button.

I even work with a fourth state. That was done a another image on a lower Z layer. It's normally invisible, when one of the other three states is visible.
UrbanCyborg
Posts: 599
Joined: Mon Nov 15, 2021 9:23 pm

Re: Multi-state Button

Post by UrbanCyborg »

Let me see if I understand what you're describing. If you group two toggles as a radio button pair, there are still really only two states, corresponding to Off/On and On/Off, but you've stacked the toggles physically, and show one or the other as needed to make it appear that there are three states, and you use a separate variable to keep track of what the state really is, rather than using the toggles' real state. Have I got that right?

If that's what you're doing, I think you could manage the same thing with just one toggle and one overlay, plus the external variable. I thought of doing that myself, but was hoping there was some way to get the functionality directly from something in VMD. I guess that needs to be a feature request.

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
User avatar
honki-bobo
Posts: 306
Joined: Sat Nov 09, 2019 1:18 pm

Re: Multi-state Button

Post by honki-bobo »

For my SubSequence module I've implemented a MultiStateButton class that uses a single VoltageToggle button and 5 skins to create a 6-state button. I've added the skins with the "Extra Skins" option in VMD. This is basically extendable to any number of states and I'm also using it for a 3-state button. I handle notifications via mouse events on the VoltageToggle button using the Object_LeftButtonDown and Object_LeftButtonUp cases and manage the states inside the MultiStateButton class. Works like a charm.
Image
Monkey Business Audio
Modules - Music - Twitter - YouTube
UrbanCyborg
Posts: 599
Joined: Mon Nov 15, 2021 9:23 pm

Re: Multi-state Button

Post by UrbanCyborg »

I acquired your two years bundle recently, but hadn't yet looked at that one. Veddy interesting. I need to bang on it some more.
Cyberwerks Heavy Industries -- viewforum.php?f=76
User avatar
honki-bobo
Posts: 306
Joined: Sat Nov 09, 2019 1:18 pm

Re: Multi-state Button

Post by honki-bobo »

That's great to hear and thanks for your support!

You might want to take a look at this thread where you can download two patches and also find a link to a YouTube video.
Image
Monkey Business Audio
Modules - Music - Twitter - YouTube
User avatar
seal58
Posts: 354
Joined: Fri Jul 12, 2019 5:28 pm
Location: Rostock, Germany
Contact:

Re: Multi-state Button

Post by seal58 »

UrbanCyborg wrote: Wed Mar 02, 2022 11:44 pm Let me see if I understand what you're describing. If you group two toggles as a radio button pair, there are still really only two states, corresponding to Off/On and On/Off, but you've stacked the toggles physically, and show one or the other as needed to make it appear that there are three states, and you use a separate variable to keep track of what the state really is, rather than using the toggles' real state. Have I got that right?

If that's what you're doing, I think you could manage the same thing with just one toggle and one overlay, plus the external variable. I thought of doing that myself, but was hoping there was some way to get the functionality directly from something in VMD. I guess that needs to be a feature request.

Reid
You are right. That's what I did.
Until now I did not work with image overlays. After your text from Thu Mar 03, 2022 12:44 am I browsed the VMD properties of a Toggle Button and found, that there are overlays for disabled states available. So it is a helpful hint for me. Thank you.
Instead of hiding the toggles I only should have to disable them.

Roland
UrbanCyborg
Posts: 599
Joined: Mon Nov 15, 2021 9:23 pm

Re: Multi-state Button

Post by UrbanCyborg »

Impressive, Messr. honki-le-bobo!

And always glad to inadvertently help, seal58. 8-)

Reid
Cyberwerks Heavy Industries -- viewforum.php?f=76
Post Reply

Return to “Module Designer”