Page 1 of 1

Notification system

Posted: Thu May 21, 2015 9:22 am
by giovanni_c
Hi all.
I'm trying to create a basic notification system to show to the user a notification stack when he receives a new information.
Basicly when the notification arrives I show a stack with the notification text and a close button. The system can be configured to autohide the notification after few seconds.

I've a little problem in doing this. Infact when the notification stack is showed the stack in which i'm workin' on lose the focus... When notification stack hides the focus return on the previous stack.
So my question is: there is a way to manage the showing of a stack without lose the focus on the actual main stack? I've tried to set the notification stack as modeless without success. The notification stack has the systemWindow property set to true but even if I set this property to false nothing changes.
Hope someone can point me to the right direction!
Thank you in advance.

Re: Notification system

Posted: Thu May 21, 2015 5:59 pm
by Simon
Hi giovanni_c,
Not sure this helps but when the notification stack shows up you can "go to stack "myWorkingStack"" but this will hide you notification stack if it's on top of your myWorkingStack.

Simon

Re: Notification system

Posted: Fri May 22, 2015 7:49 am
by hliljegren
I think you can use the focusedObject

Before you open the notification stack you can save the current focusedObject

put the focusedObject into tObjectToReturnTo

and then open the notification stack and finally set the focus back via:

focus tObjectToReturnTo

:-HÃ¥kan

Re: Notification system

Posted: Fri May 22, 2015 8:28 am
by giovanni_c
Hi all. Thank you for your replies!
I've tried both your suggestions and both work well enough (in any case I've a little "flash" but i think it's acceptable). Thank you!

I prefer the first solution (go to stack ...) because mantains correctly the focus on a field if i'm writing something while the notification appears. I've set the systemWindows of notification stack to true so the stack is always on top of the others.

Re: Notification system

Posted: Fri May 22, 2015 5:30 pm
by jacque
A system window will float over other apps too and will always be visible everywhere on the computer. If you only want it to be visible within your own app, set it up as a palette. That may solve your focus problem too.