PDA

View Full Version : Rob, modified PanelWatch.lua



mhwlng
August 4th, 2007, 05:56 AM
Hi Rob,

I added 3 public functions to PanelWatch.lua :
RegisterLeavePanelWatch
UnregisterLeavePanelWatch
ProcessPanelWatchLeavePanel


RegisterPanelWatch("*", "NOWPLAYING", Marcel.mediacenter.panelevent);
RegisterLeavePanelWatch("*", "NOWPLAYING", Marcel.mediacenter.panelleaveevent);


These callbacks get called when navigating to another panel.

I use it, for example, to send a command to girder to stop streaming live tv, when I leave the tv panel...

You can call ProcessPanelWatchLeavePanel() on your exit NR button, to perform any processing for the termination of the current panel, just before NR is stopped...
(obviously, this doesn't work if you exit NR via file\exit)

Could you add this code (or similar functionality ) to the next NR revision ?

Thanks,

Marcel

Rob H
August 4th, 2007, 08:30 AM
Thanks Marcel.

Just wondering whether it might be better to call this from the PageLoading event handler instead, at which point all the controls from the previous page should still be available - what do you think?

mhwlng
August 4th, 2007, 08:38 AM
you currently didn't implement RegisterPanelLoadingWatch (it's commented out) so I assumed that there was a problem with it and stayed away from it ?

I haven't tested if the controls for the previous panel are still available from PageLoading...

if that's the case, then I agree, that your idea is better...

(at the moment, I only use this 'leave' callback to send commands to girder)

Marcel

Rob H
August 4th, 2007, 08:42 AM
Hmm... so it is. I wonder why I did that?! :)