I've created a component in my app that is a message box with Yes/No options. I've then added custom properties to set the Title, Message, and actions for each of the clicks (set to Property type Event).
This works a treat when setting each of the values to a variable on my canvas and I can pop up the message with a custom title and message but I want to be able to set the actions to a variable as well - how can I add an action to a variable eg set a variable to "Set(varMessageBoxVisible, false)" and then use that variable for the OnSelect action of the button.
Not sure I've worded this the best way possible! 😃
I see, so try this:
First turn on the 'Enhaced component properties' (settings -> upcoming features -> experimental)
Create a new Property and select 'Event' under 'Property type'
In this case I created it as vEvent, to call this event inside the component use <component name>.<Event property>()
Now, go back to your app, add the component and set the property that you created:
I hope it helps 🙂
Thanks @victorcp
I'll try give a bit more context!
This is my Component, I have 4 custom properties - 2 are input fields for the title and message, this bit works fine.
I show the message box from a button using the following:
This allows me to call the message box anywhere in my app and have it show a different message but I need to customise what Yes/No does each time. In this example No just needs to be Set(VarCancelVisible,false) to just get rid of the message box and Yes needs to do the following to reset the form:
Set(varPostcode, "");
Reset(cmb_Customer_1);
Reset(cmb_Product_1);
Reset(txt_QtyToReturn_1);
Set(VarCancelVisible,false)
In some cases I only have a single message box on a canvas so I can just set it directly in the YesOnSelect property, but where I need the same message box to do different things I'm after a way to dynamically set the event on the button.
Hello!
Let me show you how I do it and hope it helps you 🙂
In the component button button, set a variable (vTeste in my case) to true/false:
Select the component (1), create a custom property (vBoolean in my case) (2) and set this new property as the variable you created in the previous step (vTeste) (3) (4)
back to your App, add your component and you can get the information using the '<name of the component>.<name of the property>' in my case Component1.vBoolean
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional