Auto tab return

Hi,
I am using “The Home Remote Design” almost 15 days and I’m impressed with the power of this software.
I developed a design for my house to control, illumination, climate control, and others. I’m using TABs to access which one of this pages to access. Everthing is working, but I would like to use some auto return to “illumination” TAB.
EX: Someone pressed the tab climate control and left this TAB as visible, I would like that after some time the software returns to illumination TAB.
Is it possible?
Thanks for any help
Willy

No, not currently. Tab selection cannot currently be automated. You have to actually click the tabs.

Thank you so much Bill

I’m currently doing that for pages for my kitchen wall tablet. Add a virtual variable “goback” and put this code in a script action in an event trigger for each page that gets loaded that you want to return. You can change the sleep time, it’s in milliseconds.

var jsDate = new Date();
App.SetDeviceAttribute(“goback”, jsDate);
var goback2 = App.GetDeviceAttribute(“goback”);
sleep(60000);
var goback = App.GetDeviceAttribute(“goback”);
if (goback2 == goback) {
App.GoToPage(“home.xaml”);
}

2 Likes

Great gregkinney,
I will try, Thank you so much…

@bill you mentioned in another thread that the above script was not ideal. I can offload the script to hardware to accomplish this. However, is there any better logic to accomplish the desired result in HR?

Not currently. I’ll have to think about this.

1 Like

hi @gregkinney,
maybe that could be solved using a plugin instead?

  • Put the polling intervall to 60 seconds.
  • In the onPoll function check the current page
  • When not home.xaml then goto home.xaml

what do you think?

BR - kro

@kro I think that’s brilliant! But I’m curious for @bill to weigh in.

You can’t make App calls in device Plugins. They are meant to be completely independent of any XAML pages. Sorry, I really don’t have a way to do this that I can endorse. You can do it like Greg was doing but just be aware you to leave yourself vulnerable to crashes. Automated calls to PushPage, PopPage, GoToPage are not really safe to use. Those were intended for Button Click events that happen pretty much immediately.

I’m certainly open to adding support for this as a new feature. I’m not sure where would be the best place to define this. Maybe I can add a property to pages where you could define X number of seconds the page should stay open, then return to previous page. Or maybe a global Screen Saver type setting, so the app will automatically return you to a specific page after X amount of time. Either way, this should probably be a managed & supported feature.

OK. I’ve thought about it a little more & what I’m thinking is at some point I’ll add an Idle event to pages. Basically you’ll handle it just like any other page event, Loaded, Unloaded, etc. I’ll also add an IdleThreshold to the page so you can specify exactly when the event should fire.

1 Like