A couple beginner-ish questions.

Post Reply
ymerejsasnak
Posts: 9
Joined: Thu Jun 04, 2020 2:08 am

A couple beginner-ish questions.

Post by ymerejsasnak » Thu Jun 04, 2020 2:31 am

Hello.

I've begun using the Module Designer and have a couple questions.

First, the documentation mentions example programs but I don't seem to have them. Where might I find them?

Second, I'm having a strange issue with my module. I'm building a sequencer type module, and everything's working well so far so apparently I mostly know what I'm doing -- except for one thing. I removed my UI components for a sequencer channel (16 toggles, 16 leds, etc.) from the UI designer window and created a method to dynamically create them as part of the Initialize method. The problem is that the components aren't visible unless I drag another component of the same type into the designer window. They're still there and I can interact with them (toggle the sequencer steps and connect the trigger output jack) but I can't actually see them unless, as I said, I add the same exact type ahead of time in the visual UI window.

I hope what I've said here makes sense. Does anyone know why this might be happening and how I can fix it? It IS possible to dynamically create components successfully, right?

Any help is appreciated. Thanks!

Jeremy

User avatar
honki-bobo
Posts: 91
Joined: Sat Nov 09, 2019 1:18 pm

Re: A couple beginner-ish questions.

Post by honki-bobo » Thu Jun 04, 2020 8:02 am

Hey Jeremy,
ymerejsasnak wrote:
Thu Jun 04, 2020 2:31 am
First, the documentation mentions example programs but I don't seem to have them. Where might I find them?
you can find the example modules in the developer kit. Log in to the CA store, got to your library and look for "Voltage Module Designer - Developer Kit". In the ZIP file you will find the example modules and the documentation.
ymerejsasnak wrote:
Thu Jun 04, 2020 2:31 am
Second, I'm having a strange issue with my module. I'm building a sequencer type module, and everything's working well so far so apparently I mostly know what I'm doing -- except for one thing. I removed my UI components for a sequencer channel (16 toggles, 16 leds, etc.) from the UI designer window and created a method to dynamically create them as part of the Initialize method. The problem is that the components aren't visible unless I drag another component of the same type into the designer window. They're still there and I can interact with them (toggle the sequencer steps and connect the trigger output jack) but I can't actually see them unless, as I said, I add the same exact type ahead of time in the visual UI window.
I haven't tried to create GUI elements "on the fly", but what I have done is changing visibility of several elements and that works very well. So you basically add all elements you need right from the beginning, but make them invisible and switch visibility as you need it.

Hope this helps.

Best regards,
Martin
Image
Monkey Business Audio
Modules - Forum

User avatar
nekomatic
Posts: 64
Joined: Mon Jul 08, 2019 8:52 pm

Re: A couple beginner-ish questions.

Post by nekomatic » Thu Jun 04, 2020 8:55 am

You need to use the AddComponent method to make VM connect it to various bits inder the hood. Also you need to follow the same order when setting up new UI component as in the code VMD generates, in general it should look like this:
- create new UI object
- apply module's AddComonent to it
- set properties - here, the order of operations is also importanat in some cases.
Remember some strings used there should be unique across all components in your module.

On the other hand it would be helpful if VMD supported XML (or something like that) as the VMD format - this could be generated by a build step i.e. in a gradle project...

andro
Posts: 127
Joined: Mon Apr 06, 2020 4:45 am

Re: A couple beginner-ish questions.

Post by andro » Thu Jun 04, 2020 1:44 pm

What is the reason for dynamically creating the GUI components? I cant see why that would be necessary? Add all at design time. If dynamic changes are needed such as hide/show do that at run time. Can you explain your rationale?

User avatar
nekomatic
Posts: 64
Joined: Mon Jul 08, 2019 8:52 pm

Re: A couple beginner-ish questions.

Post by nekomatic » Thu Jun 04, 2020 2:01 pm

andro wrote:
Thu Jun 04, 2020 1:44 pm
What is the reason for dynamically creating the GUI components?
It is much easier to distribute arrays of components during runtime - One of my modules (still unreleased due to some unresolved VM API issues) has 16 'banks', where each bank has its own set of controls - Because of certain properties of VM's API it is much easier to keep all of them as discrete 'pages', one 'page' per bank - buiding this manually would be massive pain, not to mention applying minor position changes etc...

It is also necessary when you need to create a custom control - like i.e. an infinite rotation knob which VM does not yet support...

ymerejsasnak
Posts: 9
Joined: Thu Jun 04, 2020 2:08 am

Re: A couple beginner-ish questions.

Post by ymerejsasnak » Thu Jun 04, 2020 2:33 pm

Thanks SO MUCH for the replies so far...but things are still not quite working out. I will try to explain better.

First, the reason I am doing this in the code is that I'm trying to make a sequencer. I currently have 16 toggles with 16 LEDs below that and changing each one's settings by hand was extremely tedious. Also, it just seemed to make more sense to create these and store them in arrays right off the bat rather than having a ton of separate component variables. Eventually, say I have 4 sequencer rows or channels or whatever you want to call it, that'll be 64 step toggles and 64 led toggles -- much easier to create in code than drag and drop and edit labels/variable names and all that! If there's another way to go about this, please let me know! :)

Anyway, the problem persists. I don't know if there's some little bit of whatever VM is doing that I'm missing or if it's some kind of bug.

I tried it in a new project and the same thing happens. This is me creating a toggle in Initialize(), copied exactly from generated code. (I also declare the toggleButton1 variable in the appropriate place).

Code: Select all

  toggleButton1 = new VoltageToggle( "toggleButton1", "toggleButton1", this, false, 0 );
   AddComponent( toggleButton1 );
   toggleButton1.SetWantsMouseNotifications( false );
   toggleButton1.SetPosition( 84, 105 );
   toggleButton1.SetSize( 31, 31 );
   toggleButton1.SetSkin( "Blue Square" );
   toggleButton1.ShowOverlay( false );
   toggleButton1.SetOverlayText( "" ); 
 
And I see nothing. But if I drag in a second toggle, added the normal way so the code is in the constructor, my first toggle also becomes visible when I run the module. Also, if instead I create a jack in Initialize(), I can interact with it (ie cable attaches) even though I can't see it. I haven't changed any visibility or Z setting, and actively trying different settings with those didn't help either. I'm at a loss and hope someone can shine some light on this issue -- hopefully I'm not being monumentally stupid about something, but if so, I'd like to know. ;)

Thanks again.
Jeremy

User avatar
nekomatic
Posts: 64
Joined: Mon Jul 08, 2019 8:52 pm

Re: A couple beginner-ish questions.

Post by nekomatic » Thu Jun 04, 2020 2:58 pm

I think I know what the issue is... The problem is most likely with the skin of the button, when you add a component via the visual editor then VM adds the skin by this name to the module resources - if you add an element via code there is no way for VMD to know which skins to include.

Seems like a hole in the toolchain...

You need to add an element which is a 'skin provider' then simply disable and hide it in your Initialize metod.

ymerejsasnak
Posts: 9
Joined: Thu Jun 04, 2020 2:08 am

Re: A couple beginner-ish questions.

Post by ymerejsasnak » Thu Jun 04, 2020 3:17 pm

Ah ok, I figured there was probably something going on behind the scenes that was causing this. Easy enough to add 'skin providers' to my module, I guess. Thanks again for the help nekomatic!

terrymcg
Posts: 51
Joined: Mon Apr 08, 2019 12:35 am

Re: A couple beginner-ish questions.

Post by terrymcg » Thu Jun 04, 2020 9:34 pm

nekomatic wrote:
Thu Jun 04, 2020 2:58 pm
I think I know what the issue is... The problem is most likely with the skin of the button, when you add a component via the visual editor then VM adds the skin by this name to the module resources - if you add an element via code there is no way for VMD to know which skins to include.

Seems like a hole in the toolchain...

You need to add an element which is a 'skin provider' then simply disable and hide it in your Initialize metod.
This. I ran into it recently with custom LED skins.

flucatcher
Posts: 52
Joined: Mon Jan 28, 2019 5:51 am

Re: A couple beginner-ish questions.

Post by flucatcher » Sat Jun 27, 2020 1:02 pm

Same thing for image overlays. Thanks for this thread, already lost way too much time on this :).

Post Reply