Anchored Layout - Vision Component

Hello,

Does anyone know how to set a custom component to use an "Anchored" layout type by default instead of "Relative"? (from java)
image

Additionally, is it possible to disable the ability to edit the layout from the designer for this component?
image

What do you mean by this? Is this a component you've created in a module? ...or a template? ...or something you've modified through scripting?

We are in the "Module Development" category, so yes, it is for a custom component created with a module.

I imagine this will have to be implemented with this class:

com.inductiveautomation.factorypmi.application.components.util.FPMILayout

2 Likes

Thank you, @justinedwards.jle !

Here is the code to place in the onStartup method of your component to ensure the layout is taken into account when the component loads.

FPMILayout.getLayoutConstraints(this).setFlags(FPMILayout.ANCHOR_N | FPMILayout.ANCHOR_W);

There might be an alternative by setting the layout value through CommonBeanInfo.

1 Like

I'm not sure this is what you are looking for but there is an option to set the default layout at a project level so that any component you drop on a window will use that specified layout.

That's interesting, but it's not exactly what I was looking to do.