Some advice on module design please.
I can sort out creation / alignment much easier in code templates than through the designer, so am looking to code the control creation rather than design it. (The other alternative would have been to template up the controls, but I can't edit the constructor).
Are there any design compliance issues creating controls in the Initialize function rather than creating them through the editor?
Dynamic control creation
Re: Dynamic control creation
I have done this a lot, and as far as I can see, it works just as well in initialize() as it does in the constructor, as long as you just do it the same way (create the control, AddComponent(...), set control params, etc).
-
- Posts: 49
- Joined: Sun Aug 25, 2019 10:26 am
Re: Dynamic control creation
That's great news - thanks!
-
- Posts: 11
- Joined: Sun Jan 02, 2022 1:58 am
Re: Dynamic control creation
Just posting a couple notes in this old topic, so some future designer isn't stumped by this like I was:
If you do your own VoltageKnob construction using a skin that isn't part of a knob that was placed using the layout design tool, you'll need to make sure that that skin is included in the module's Extra Skins... list.
If you want to add a VoltageKnob as a child to a VoltageRectangle, as opposed to the module itself, the rectangle has to be marked with 'Wants Mouse Notification' in order for its child knobs to be editable.
If you do your own VoltageKnob construction using a skin that isn't part of a knob that was placed using the layout design tool, you'll need to make sure that that skin is included in the module's Extra Skins... list.
If you want to add a VoltageKnob as a child to a VoltageRectangle, as opposed to the module itself, the rectangle has to be marked with 'Wants Mouse Notification' in order for its child knobs to be editable.
Re: Dynamic control creation
Ah, nice tip!tristanshoutsf wrote: ↑Wed Aug 10, 2022 5:02 am If you do your own VoltageKnob construction using a skin that isn't part of a knob that was placed using the layout design tool, you'll need to make sure that that skin is included in the module's Extra Skins... list.
It's not just knobs of course, it's any GUI component that uses a skin not included by the editor. Traditionally, I've been creating hidden components that use the skin(s), but this is a much neater method.
Cheers,
--
Terry McG