Layout Close Button

What I’m trying to do:
As I use the new Layouts feature, I am starting to understand it usefulness more and more. It’s a great enforcer for clean structure.

Anyways, I am attempting to add a default self.raise_event('x-close-alert') button in my Alert Layout, but this requires me to add the button click logic to the form inheriting that Layout. Is there a way to have the “self” referenced in the Layout code, refer to the form using that layout?

It’s easy enough to add that logic in the actual form, it would just be nice to have code in the layout instead of having to duplicate it.

Thanks!

I just had the button raise the event with the event_args[“sender”] prop:

1 Like

You, good sir, are a genius!

I knew I was missing something obvious.

Thank you :slight_smile:

1 Like

Unfortunately, I thought that method would work, but It does not.

Here is an example of the issue:

The example you provided is a bit different because the layout instantiated as itself, instead of using it in another form that uses that layout. then instantiating that form.

2 Likes

Ahh, that’s true.

I added a consumer property to the layout when ThisUsesLayout is initiated to itself and then the close button in the layout raises the event with the consumer attribute.

2 Likes

I think this has to be the simplest solution , unless some magic happens at the point of the layout being formed.

Appreciate the help! :slight_smile:

1 Like