Gtk GUI - Select next control - gtk

When Gtk GUI is started seems that Gtk sets "optimal" focus order to his controls which can be switched (beside usual way) with arrows. Then we can easily move (modify) focus order with "grab" to whatever enabled widget.
In case of GtkEntry, after pressing enter key "activated" event raises where I do validation and then I would like to jump to next control, like I was pressed "down arrow".
For now I transfer focus with "grab" and explicit name of wanted control but I would like to jump to "next" control of gtk's order without referencing it.
Also I transfer focus manually in keypress event of entry but this is also too fixed and unwanted way.
If I woud be able to set focus to "next control" this can make later modification in GUI much simpler.
Is this possible and how?
Thanks.

The PyGTK FAQ has one way to set tab order and two different ways to traverse it. These are likely the same in whatever language you're using.

Related

How to give the keyboard focus in NetLogo

It's possible to designate a key as associated with a NetLogo button. But the key-press will not activate the button unless the keyboard is in the appropriate state. (I'm not sure what to call that state.) For example, when one starts a model, keys do not activate buttons until one clicks the background outside both the view and the command center. (Try Games > Frogger, Minesweeper, etc. in the Models library.) Also, if one types into the command center, one must click outside to re-active the key-button connections.
Is there a way to activate the keyboard-button connections with code -- so that it can be done, e.g., in setup?
No, this isn't under programmatic control, and it's by design that the command center normally has keyboard focus.
As a user, the easiest thing to do is hide the command center (there's even a keyboard shortcut for this) if you aren't using it, then the keyboard focus will be on the widgets.

Widget sensitive/gray look change with window focus causes too much delay

I like to adjust or disable a feature of gtk3 (or gnome-shell?) because it causes a delay or at least need to remove the delay when bringing a window in/out of focus. My multi window application suffers from this delay:
I see is that all widgets like buttons, entries, etc. are set to in-sensitive/gray look at time the window they are contained is loosing focus and they return to normal when the window focus returns. I tried to turn off animations, but that does not disable this behavior.
My old program version based on gtk2 based does not have this feature (same gnome shell). So I conclude gtk3 is some how managing this.
I so far was not able to find out how to disable this.
This is part of the default (Adwaita) desktop theme, and as such you can't disable it for one application. Each window's widgets get the :backdrop CSS pseudo-class when it is not the active window, and the Adwaita theme styles them that way.
Your best bet is to pick another desktop theme.

Undecorated window loses native events

I use Decorated = false to make a frameless, borderless window with gtk#. This means adding my own drag logic and events for minimizing and closing the window, fine. However in Windows (at least), the window loses its native minimize/restore/close animations and I'm unable to minimize the window by clicking in the taskbar as you usually can.
Is there a way to have an undecorated window in gtk and still get the native minimize/restore animations or at least being able to minimize it from the taskbar?
I've experienced this as well. It is my understanding (maybe incorrect) that such features are a part of the windowing for the application. With it undecorated they simply don't exist in the taskbar. You might be able to create "Tasks" that are available when you right-click on the taskbar icon, but I have no experience with doing so. I believe those are technically called "JumpLists" or something like that.

GTK window hints

I'm trying to get a window to cover the whole screen. Its positioning and dimensions is fine but it gets covered by the Gnome panel. To complicate things I have two monitors and this app needs to support people with multiple screens.
WINDOW_TYPE_HINT_SPLASHSCREEN is a good start. It covers both screens but not the panel. It's still there, just behind the panel.
WINDOW_TYPE_HINT_DOCK looked ideal but I need this window to take focus to listen to a keyboard event. _DOCK seems like it purposely ignores keyboard events (which kind of makes sense). Can I force it to take keyboard focus?
Is there some way I can force a hinted window to cover the panel?
There's window.fullscreen() which you can call on a normal "un-hinted" window. I assume this lets the window manager decide whether the window should cover the panel or not.
If you use the WINDOW_TYPE_HINT_MENU, you can give the focus to the window by calling the gtk_window_present() function.
However, I don't know if you will be able to cover the panel.
Another hint: the panel probably change its _NET_WM_STRUT property so that other windows cannot cover it. Maybe you will have to play with this property (or another) in your window.

Faster way (keyboard shortcuts?) to use quick fixes in Eclipse?

I often use the Eclipse feature (Galileo) of suggested error corrections to automatically create code stubs or to refactor things. For example, I would write a method that calls other methods which don't exist yet, then move the mouse over the error message and click on "create method". Or, change this to the class name and choose "add static modifier" from the quick fixes.
I think this is very convenient because it lets me stay in one place in my code and sort of "remotely" wire up what's not currently visible on my screen. What I think is annoying though, is that I have to leave the keyboard, hover my mouse over the error symbol, wait for the tooltip to pop up, and click on the option (doing that, I sometimes move the mouse a little over the edge and the tooltip goes away again - very annoying).
Am I missing a faster method here? I can't seem to find a keyboard shortcut, but then I have overlooked stuff from the huge preference dialog before.
Ctrl+1 : Quick Fix.
(Cmd+1 on Mac)
Just put your cursor on the part you suspect you can perform an action (correction, refactoring, ...) and hit the Quick Fix shortcut. The same popup will be displayed, and you can select the right option with the up and down keys.
That, combined with Ctrl+3 (Quick Access) gives you most of eclipse features at your fingertips ;)
See also:
Eclipse Tip: Shortcut to Quick Fix
My Favorite Eclipse Shortcut: Quick Fix
Eclipse hotkeys: eclipse shortcuts gold mine.
As an additional tip, a specific type of quick fix I use all the time has a dedicated shortcut:
Alt+Shift+J: Add Javadoc comment stub for current method.
After using ctrl+1 like mentioned in the top answer, press ctrl + enter to apply the selected fix all to problems of the same category.
In general, keyboard shortcuts in IDEs (and code tools in general) are coming from a user principle that holds that the more your hands/fingers can remain poised over the keyboard (as in the f-j centered "touch typist" position), the more productive you can become. This is probably why the use of the number keypad is not encouraged, or other keys, less common to the most basic layout keyboard, are not used. Many hold that useful keyboard shortcuts should be easily reachable from this position.
One thing I will say about eclipse keyboard shortcuts is that if you use a popular Windows presentation utility called Zoom-it, you need to turn that off when using eclipse. There are several show-stopper conflicts between the two, such as Ctrl-1 and Ctrl-3.