# Anchored Layout - Vision Component

**URL:** <https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184>\
**Category:** Module Development\
**Tags:** vision\
**Created:** [May 31, 2024, 7:29am UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184 "2024-05-31T07:29:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![e.sagnelonge](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@e.sagnelonge](https://forum.inductiveautomation.com/u/e.sagnelonge)\
**Post date:** [May 31, 2024, 7:29am UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184/1 "2024-05-31T07:29:53Z")

</div>

Hello,

Does anyone know how to set a custom component to use an "Anchored" layout type by default instead of "Relative"? (from java)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/b/2bbfc9e131d707348d130cb88f2cea1fdda93c5a.png)

Additionally, is it possible to disable the ability to edit the layout from the designer for this component?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/e/ce56c1c47514510e6b11088d3e5b071ef77686d2.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 31, 2024, 7:46am UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184/2 "2024-05-31T07:46:03Z")

</div>

> [@e.sagnelonge](#):
>
> custom component

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?

---

<div class="post-metadata">

**Author:** ![e.sagnelonge](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@e.sagnelonge](https://forum.inductiveautomation.com/u/e.sagnelonge)\
**Post date:** [May 31, 2024, 8:01am UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184/3 "2024-05-31T08:01:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 31, 2024, 8:07am UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184/4 "2024-05-31T08:07:05Z")

</div>

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

[com.inductiveautomation.factorypmi.application.components.util.FPMILayout](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.32/com/inductiveautomation/factorypmi/application/components/util/FPMILayout.html#addLayoutComponent(java.lang.String,java.awt.Component))

---

<div class="post-metadata">

**Author:** ![e.sagnelonge](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@e.sagnelonge](https://forum.inductiveautomation.com/u/e.sagnelonge)\
**Post date:** [May 31, 2024, 8:35am UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184/5 "2024-05-31T08:35:20Z")

</div>

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.

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

```

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

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [May 31, 2024, 3:47pm UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184/6 "2024-05-31T15:47:58Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/1/91941d89932e07e25207cd37ecd7ce56bc2e128a.png)

---

<div class="post-metadata">

**Author:** ![e.sagnelonge](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@e.sagnelonge](https://forum.inductiveautomation.com/u/e.sagnelonge)\
**Post date:** [June 3, 2024, 7:10am UTC](https://forum.inductiveautomation.com/t/anchored-layout-vision-component/91184/7 "2024-06-03T07:10:37Z")

</div>

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