343 views
in GUI Development by
I have multiple dialogs in my UI (multiscreens). How can I organize the activation of screensaver on wizard level. I mean after a certain defined time start the screensaver (e.g. after no clicks within 10 minutes etc.) . Where can I build hook functionality? Or is it only possible with "intercept touch" in the GUI main loop?

1 Answer

0 votes
by

Hello Waldi,
For a scrennsaver you have to check the user interaction within the GUI. This you can do within the root object of your application. Here all Drive... methods are handling the user input. See DriveCursorHitting(), DriveCursorMovement(), DriveKeyboardHitting(), DriveMultiTouchHitting(), DriveMultiTouchMovement(). So just overwrite these methods and add your code. Do not forget to call the super!
Besides of this you can add an inactivity timer which you reset on each user interaction. When the timer fires, you present the screen saver.

The code for DriveCursorHitting night look like this:

restartInactivityTimer();
return super( aDown, aFinger, aPos );

So the section for handling screen saver within your root class can look like this:

 

by
This method works fine, but I'm having trouble forwarding this timer event to Main::Wnd.

I create MainWnd in Application::Init with GetRoot().PresentDialog (new Main::Wnd, ...).

I also have the extra variable Main::Wnd too (like your variable "screenSaver") .

If I try "Timer Fire" in Variable Main::Wnd (like your "screenSaver") by signal to start a screensaver at its slot, I get "access to zero element/object". And it doesn't matter if I create variable Main::Wnd by "new Main::Wnd" in field-parameter "Default".

There definitely exists Method which has a solution for it.
by

When the inactivity timer fires, you can create the screen saver and present it. Also you have to establish a connection from your screen saver to the embedding owner. This you can do for example by defining a slot property within the screen saver and assign a slot from the owner to it.
Here examples for the methods shown in the previous screen shot.

onInactivityTimer

// create and display ScreenSaver
if ( screenSaver == null )
  screenSaver = new Application::ScreenSaver;

if ( screenSaver != null )
{
  screenSaver.OnTouch = onScreenSaverTouch;
  if ( screenSaver.Owner == null )
  {
    ScreenContainer.Visible = false;
    PresentDialog( screenSaver, Configs::ScreenSaverFadeIn, null, 
                   null, null, null, null, null, null, true );
  }
}

// stop inactivity timer
inactivityTimer.Enabled = false;

 

onScreenSaverTouch

// remove ScreenSaver
if( screenSaver != null && screenSaver.Owner == this )
{
  DismissDialog( screenSaver, null, null, null, onScreenSaverFinished, null, true );
}

screenSaver = null;

 

Embedded Wizard Website | Privacy Policy | Imprint

...