cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Patch
Level: Powered On

Create a Button Component that has a property for OnSelect

I am working on an app and have been implementing the new Components feature. I am trying to create a button Component that will allow me to control the look of the button and allow me to modify the OnSelect property of the button control with a 'created property' in the Custome Component, but it is not working. I get a formule error. 

 

Capture1.PNG

Does anyone have any thoughts on how to make this work. maybe I have the wrong data type selected. I have text select at the moment but I have tried others.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Create a Button Component that has a property for OnSelect

@Patch 

Not at this time...PLEASE vote for it here
It would REALLY make Components shine.  Because I believe a lot of people will be trying to make components of "common screen elements" and often, common screen elements will be Menus, PopUp boxes, and other items that NEED an OnSelect or other definable Action.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Create a Button Component that has a property for OnSelect

@Patch 

What property is this in?  Your picture cut off the left side to see.  But it is basically saying that you are putting a statement where it shouldn't be.  If you are doing this in an OnSelect or some other action, it should be fine.  If you are doing this on any other property, you can't use a Set function.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Patch
Level: Powered On

Re: Create a Button Component that has a property for OnSelect

@RandyHayes ,
I created a Component called 'BtnLrg', in it I created a custom property called 'Action' with a data type of 'Text'. I then added a button control to the component and in the 'OnSelect' properter I enter the sytax 'BtnLrg.Action'.  

 

BtnLrg.Action

Then when the component is added to the screen; I set the 'Action' property to 'Set(VarTestFilter,true);Set(VarInspSelectDisable,DisplayMode.Disabled)'

Set(VarTestFilter,true);Set(VarInspSelectDisable,DisplayMode.Disabled)

and that is when I get the error. I think I am misunderstanding something or just missing something.

Super User
Super User

Re: Create a Button Component that has a property for OnSelect

@Patch 

Right, so in this case you are trying to do a Set in a text property...which is not allowed or valid.

There is no concept currently of "raising actions" from your components.

You would need to wire it up differently - in my case I used a toggle on the screen the component was embedded in to simulate the Action being raised.  But it was less than ideal and really broke the "portability" concept of the component.

Incidentally, I have an Idea in the idea forum for exactly this feature.  Please check it out and Vote on it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Power Apps Staff Mr-Dang-MSFT
Power Apps Staff

Re: Create a Button Component that has a property for OnSelect

Echoing @RandyHayes, you can't place actions where they would not belong.

 

Components do not have a custom property for behaviors like OnSelect today, but you can still change the behaviors of controls within the component to do the actions you want.

Patch
Level: Powered On

Re: Create a Button Component that has a property for OnSelect

@Mr-Dang-MSFT

 

So it is not possible to set up a component that is a button, or an icon, and have the 'OnSelect' action be in or comprised of a custom property?

Super User
Super User

Re: Create a Button Component that has a property for OnSelect

@Patch 

Not at this time...PLEASE vote for it here
It would REALLY make Components shine.  Because I believe a lot of people will be trying to make components of "common screen elements" and often, common screen elements will be Menus, PopUp boxes, and other items that NEED an OnSelect or other definable Action.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Super User
Super User

Re: Create a Button Component that has a property for OnSelect

@Patch 

Right...because you are trying to do a behavior statement in a text field.  You can't do that!

There is no current way to create an Action on a Component.  You can handle actions within the component, but the component cannot interact with items outside of the component.  Your component can change properties within it (output parameters),  and you can set properties from outside it (input parameters), but you do not currently have an Action parameter.  So there is no way for it to "raise" an action where you could put a behavior formula like you have.

Again...vote for this in the ideas forum.

This would be the only way you could do that.  Otherwise, you have to do some seriously clunky methods inside of your hosting screen to "monitor" the values of the parameters and act on them if they change - sounds easy enough, but it's a nightmare and, at the end of the day, it would have been easier to just maintain the "component" as separate controls rather than make a component.

Go vote!!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,459)