cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Courtney
Helper V
Helper V

Timer Control (OnHidden)

Hi All, 

 

I have a timer set to update context (OnTimerEnd) to show the date and time on 2 text boxes.

UpdateContext({time:Text(Now(),"[$-en-US]hh:mm:ss")});UpdateContext({date:Text(Now(),"[$-en-US]dd/mm/yy ")})

 

I would like this to run when the screen is not visible (OnHidden) so I can use the text from the updated labels throughout the app. This will save me creating a timer function for every screen that is visible. 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Courtney ,

I agree with @iAm_ManCat's opinion about Timer.

I'm afraid it's not supported to make a Timer keeps running when you are in other screens.

 

So your current problem is about how to update data and fill color of a textinput when you are in other screens?

The answer is yes. You could change a textinput's data and fill color  from other screens.

I've made a similar test for your reference:

in screen1, if I click a button, I will change the text and fill color of a button that is in screen2.

1)in screen1

set the button's OnSelect:

Set(var,true);Reset(TextInput1)

2)in screen2

set the textinput's Default:

If(var,"test")

set the textinput's Fill:

If(var,Red,White)

 

If you click the button in screen1, the button in screen2 will display text "test" and its fill color will change from white to red.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
iAm_ManCat
Super User
Super User

Heya!

 

Timers can only run while the screen they are on is currently visible, so if I'm understanding correctly then you want the timer to run while you are on another screen? If yes, then that's not currently possible as timers dont 'play' unless you are on the screen that the timer is on, so you'd have to create multiple timers, one for each screen if you want them to update values while on another screen,

 

Its a limitation I've had to deal with before, and currently the only way is to have multiple timers.

I also usually set global variables with the timers so that they are screen-independent, that way the other timers can update the same global variable when they OnTimerEnd,

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Thanks! @iAm_ManCat  I thought this approach would help to avoid the issue I am having with where things seem to fall apart "Check your twitter as I caught the problem on camera at last!" 

I was also trying to update a text box off-screen when a user presses a button using the Set function as this is a global variable but I just got it working. Would also like to change the fill colour of the same text box but can't figure that out. 

Hi @Courtney ,

I agree with @iAm_ManCat's opinion about Timer.

I'm afraid it's not supported to make a Timer keeps running when you are in other screens.

 

So your current problem is about how to update data and fill color of a textinput when you are in other screens?

The answer is yes. You could change a textinput's data and fill color  from other screens.

I've made a similar test for your reference:

in screen1, if I click a button, I will change the text and fill color of a button that is in screen2.

1)in screen1

set the button's OnSelect:

Set(var,true);Reset(TextInput1)

2)in screen2

set the textinput's Default:

If(var,"test")

set the textinput's Fill:

If(var,Red,White)

 

If you click the button in screen1, the button in screen2 will display text "test" and its fill color will change from white to red.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
DataWhisperer
Regular Visitor

I solved the issue of the local variable. According to my design, it has nothing to do with whether is a local or global variable but resetting the timer and the placement of the reset. I created a small app, here is a snapshot of it. BTW, how can we upload something an app or video here to share in answer?  Hope this helps.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,078)