cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gabrz
Advocate IV
Advocate IV

Execute a toggle on a different page

Hi,

 

I'm experimenting with re-usable code in a (hidden) toggle button. That I also want to trigger from an other page.

Everything works fine in Studio, but when I publish the App the behavior is different.

 

On Page 1 I have a hidden toggle to change the Background color.

Power1.PNG

 

The toggle is triggered in the OnStart

Power2.PNG

 

On Page 2 I have a toggle to switch to DarkMode.

Power3.PNG

 

When I run this in Studio, the background immediately changes. But when I publish the App, the background doesn't change. But when I use the back button, to navigate to the previous screen, the background does change color.

 

Why is the behavior different? And will this change in the future?

 

Attached is my test App.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Gabrz
Advocate IV
Advocate IV

Thanks for the hint. I found the solution/workaround in this post

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Reuse-code-with-toggle-button/m-p/4...

You don't reference the variable, but the hidden toggle itself.

Power4.PNG

 

Still weird though that, before, it did work in Studio and not in "Play". Like it's a different runtime engine or something.

View solution in original post

2 REPLIES 2
mdevaney
Super User III
Super User III

@Gabrz 

You'll want to check out a post made by @iAm_ManCat  this morning.  I think he was helping with a similar issue and the solution was quote

 

"to have a reference to that variable on the same screen that you are calling from, ie just a label set to that variable.

I didn't notice this on my existing samples vs a blank test as normally I would have conditionals or other logic on that variable around the same screen"

 

Check out his original post here and make sure to give Kudos 🙂

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Call-code-easy-way-to-reuse-code/m-...

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Gabrz
Advocate IV
Advocate IV

Thanks for the hint. I found the solution/workaround in this post

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Reuse-code-with-toggle-button/m-p/4...

You don't reference the variable, but the hidden toggle itself.

Power4.PNG

 

Still weird though that, before, it did work in Studio and not in "Play". Like it's a different runtime engine or something.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (3,188)