Discussion:
[platform-swt-dev] Shell.getFocusControl
Thomas Singer
2018-07-16 10:30:52 UTC
Permalink
Hi SWT designers,

Assume you have 2 standalone shells, each with a couple of controls. The
active shell's focuses control is the one which is returned by
display.getFocusControl(), but also the the second, inactive shell has a
focus control. It is the one that gets the focus if the shell is
activated. Why a shell does not have a method to return its focus
control, even if the shell is inactive? What is the preferred way to
change the shell's focus control without activating the shell?
--
Best regards,
Thomas Singer
=============
syntevo GmbH
https://www.syntevo.com
https://www.syntevo.com/blog
Nikita Nemkin
2018-07-16 12:46:23 UTC
Permalink
Hi Thomas,

The preferred way is to hook shell Activate event and set the desired focus
at activation time. Until the shell is active, just save the pending
focus control
reference somewhere.

Focus control of an inactive shell is not a system level concept, it's
something that SWT does manually (see Decorations.savedFocus). Maybe that's
why there's no public API.

​
Best regards,
Nikita Nemkin
Thomas Singer
2018-07-16 13:13:05 UTC
Permalink
Hi Nikita,

Thank you for your answer.

Do I understand it correctly, that there is no way to set a focus
control without activating the parent shell on the system level? So on
Windows, macOS and/or GTK no focused control is remembered on a
deactivated shell and only is restored by SWT?
--
Best regards,
Thomas Singer
=============
syntevo GmbH
https://www.syntevo.com
https://www.syntevo.com/blog
Post by Nikita Nemkin
Hi Thomas,
The preferred way is to hook shell Activate event and set the desired focus
at activation time. Until the shell is active, just save the pending
focus control
reference somewhere.
Focus control of an inactive shell is not a system level concept, it's
something that SWT does manually (see Decorations.savedFocus). Maybe that's
why there's no public API.

Best regards,
Nikita Nemkin
_______________________________________________
platform-swt-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Nikita Nemkin
2018-07-16 14:56:53 UTC
Permalink
Hi Thomas,

You understand correctly. Keyboard focus is a global property, parent shell
of a focused control is active by definition.

Cocoa and GTK do remember and restore focused controls of inactive shells,
but SWT uses its own focus saving and restoring on all platforms.
(Probably because it interacts with tab order which is also emulated by
SWT.)


Best regards,
Nikita Nemkin
Post by Thomas Singer
Hi Nikita,
Thank you for your answer.
Do I understand it correctly, that there is no way to set a focus control
without activating the parent shell on the system level? So on Windows,
macOS and/or GTK no focused control is remembered on a deactivated shell
and only is restored by SWT?
--
Best regards,
Thomas Singer
=============
syntevo GmbH
https://www.syntevo.com
https://www.syntevo.com/blog
Post by Nikita Nemkin
Hi Thomas,
The preferred way is to hook shell Activate event and set the desired focus
at activation time. Until the shell is active, just save the pending
focus control
reference somewhere.
Focus control of an inactive shell is not a system level concept, it's
something that SWT does manually (see Decorations.savedFocus). Maybe that's
why there's no public API.
​
Best regards,
Nikita Nemkin
_______________________________________________
platform-swt-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Loading...