cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vsslasd
Advocate V
Advocate V

How to Click on a button on a different form

How does one Click on a button on a different form?

 

Select(Button1) works if Button1 is on the current form.

 

But what if Button1 exists on another form ?


Can this Button Click happen in the background, or must the form appear after it it has been navigated to ?

3 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User
Super User

@vsslasd 

Select will only impact controls on the current screen.

 

If you're trying to kick off a formula, you might consider using a Toggle (on any screen).

Create a toggle.  Put your formula in the OnCheck of the toggle and add one statement at the end of your formula.  Something like this : Set(runRoutine, false)

Set the Default of the toggle to runRoutine (or whatever you call the variable above)

Then, in places where you wanted to "select the button" instead, put a Set(runRoutine, true)

That will toggle the toggle to true and will cause the OnCheck formula to execute.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Controls on other screens will not trigger their actions unless the active screen has a dependency on the control from the other screen. The control must be referenced somewhere. This is by design.

 

Here's the pattern I use:

 

Screen5

 

ToggleButton.Default
runPatch
ToggleButton.OnCheck
Patch(...); Set(runPatch, false)

 

 

 

Screen2

 

Button.OnSelect:
Set(runPatch, true)

 

So Screen5 has a dependency on a variable from Screen2. Screen2 just needs a dependency on the toggle. Somewhere on Screen2, make a reference to: ToggleButton.Value. This could be in a label.

 

 

View solution in original post

@Mr-Dang-MSFT 

That is definitely explaining why I'm not hearing cries from any of my app users.  Since I typically will put most all formulas of redundant need or of any substantial complexity on a dedicated screen...and then use a toggle to "call" them, I am pretty sure that most apps have some dependencies.

But, I can see getting into trouble with this - only because trouble lurks when you can do one thing in design and it doesn't work in play. Smiley Frustrated

 

As for @vsslasd , I suppose in this case, if a dependent control is placed on the "calling" screen (even if not visible), that would solve the issue.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

26 REPLIES 26
RandyHayes
Super User
Super User

@vsslasd 

Select will only impact controls on the current screen.

 

If you're trying to kick off a formula, you might consider using a Toggle (on any screen).

Create a toggle.  Put your formula in the OnCheck of the toggle and add one statement at the end of your formula.  Something like this : Set(runRoutine, false)

Set the Default of the toggle to runRoutine (or whatever you call the variable above)

Then, in places where you wanted to "select the button" instead, put a Set(runRoutine, true)

That will toggle the toggle to true and will cause the OnCheck formula to execute.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Thank you. That was most helpful.

This seems to work great in the Developer Studio version, but does not work in the Desktop Player version, nor on the Mobile Version.

 

Are there any special configuration settings required for these other two environments ?

I tried this:

It totally works in the Studio Developer Mode.

But it does not work in the Windows Desktop Play Mode, nor the Mobile Phone App. It starts correctly, but never does the patch or end runPatch,false.

 

Screen2

Button | Onselect

Set(runPatch, true);

 

Screen 5

ToggleButton | OnCheck

 

Patch Statement Here..

 

Set(runPatch, false);

 

 

Any thoughts ? Thank you.

@vsslasd 

Hmm...this technique works well for me in many many apps.

 

I would suspect there is an issue with your Patch formula.  If it never sets the runPatch to false, then it is hitting an error before it gets to that. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Yes, I hear  you. Thank you.
But the issue is that it is successful in the Developer Run Mode, just not the Player Mode. I don't see how the code would would impact that.

I will make some simple commands that I can test.

 

@vsslasd 

Yes, so again, the issue is most likely the formula is failing in the player.  Not so much the toggle concept and how to kick that off.  

If there is an error in your patching in that toggle (play time vs design time), that would be what I would focus on.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I made this very simple, so I could see what was happening:

 

Created a PatchScreen.

Added a Toggle to the Screen with a default value: runRoutine

 

On the OnCheck property:

Set(runRoutine, false);

 

 

On my main screen, created a button

On the OnSelect property:

Set(runRoutine, true)

 

I have a rectangle whose Visible property is set to runRoutine.

 

I click the button in the Developer Runtime mode.

 

The Pop Up appears very quickly and disappears, as expected.

 

On the Mobile Phone App and the Desktop Player App.

The Popup window appears but does not ever disappear, and it should.

 

The code is very simple. That's all there is to it.

 

It works correctly in the Developer Runtime, but not the others, unfortunately.

 

 

 

So I'm wondering if there is something in the "App Settings" configuration that needs to be set.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,169)