Anyone use MigLayout to dynamically make a screen at runtime?

I assume this will only work with vision but it’d be nice to be wrong.

I’ve been doing work with Swing directly in an attempt to learn java and I’ve been using MigLayout which has been really nice. I was wondering if there was a way to use it in Ignition. I’m sure everyones experience the annoyance of accidentally moving a component when you didn’t mean to. It would be nice to be able to add a component to a row, or switch rows of components, by moving a few lines of code, as opposed to physically moving the components.

I came across this post - Template canvas - Layout Positionning - #2 by nmudge

and see that Nick Mudge had an article about doing so, but that link is unfortunately dead. I was wondering - does anyone here do dynamically creating of screens at runtime? Bonus points for using MigLayout.

The template canvas natively uses MigLayout when not using absolute positioning. Was using it last week with some variable-sized templates. Carry on.

Oh so this is only in relation to templates inside a template canvas being able to take advantage of MigLayout, Nick did not mean making a whole screen with MigLayout. Ok :frowning:

Might be possible to subclass Vision’s BasicContainer and drive components with MigLayout. Would have to be a module.

Darn, I was going to suggest that you could try just setting the layout manager directly in window initialization code, but:

        if (!(mgr instanceof FPMILayout)) {
            throw new IllegalArgumentException(
                "Cannot set the layout manager for SpringPanel to a non-FPMI layout manager.");
        }
1 Like

I can imagine some cool stuff nesting BasicContainer and a “MigContainer” inside each other.

1 Like

Here’s Nick’s article, for posterity.
https://web.archive.org/web/20190122061240/http://nickmudge.info/post/ignitions-template-canvas-dynamically-creating-screens-at-runtime

1 Like

Yea I found it via wayback machine. Looks like you have to make the components you want to take advantage of MigLayout in the template canvas it’s own separate template just so you can put it into the template canvas. Makes sense but it’s not exactly what I thought the raticle was going to be about.

I know it’s not in the cards given the whole point of Designer/Ignition is rapid application development with drag and drop functionality so you can get a simple app up and running in hours, but I would love to be able to programatically make the GUI/property changes etc so its all in one file you can look at at one glance and version control a la a java swing app.

There have been numerous pleas for IA to make Vision’s window XML deterministic and human-editable. Which would also make them git-friendly if used as the resource format. All pleas falling on (not quite) deaf ears, so far. ):

4 Likes