I've Wikied a code snippet to provide Tab and Shift+Tab navigation through a list of widgets. Hopefully that can be useful to others.
There is a problem with the caret (cursor within Editbox and MultilineEditbox) when clicking on the title bar of a FrameWindow or a widget not within a widget not included within the tab order; the focus remains on the appropriate widget but the caret disappears. I have not been able to figure this out.
Tab Order
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Made compatible with CEGUI v0.5 release
TODO: Replace the secondary window/dialog with a TabControl to show how to navigate each page of a TabControl (not that it's hard to figure out how to do that from the TabNavigation.h header).
Would also be nice to figure out a way to navigate from one window/dialog to the other. The call to setParent() can be used to maintain a list of such windows/dialogs. However alt-tab and shift-alt-tab are reserved hotkeys under Microsoft Windows and I do not want to mess with those. The hotkeys to activate the next or previous window/dialog could be user-configurable, such as ctrl-tab and shift-ctrl-tab.
TODO: Replace the secondary window/dialog with a TabControl to show how to navigate each page of a TabControl (not that it's hard to figure out how to do that from the TabNavigation.h header).
Would also be nice to figure out a way to navigate from one window/dialog to the other. The call to setParent() can be used to maintain a list of such windows/dialogs. However alt-tab and shift-alt-tab are reserved hotkeys under Microsoft Windows and I do not want to mess with those. The hotkeys to activate the next or previous window/dialog could be user-configurable, such as ctrl-tab and shift-ctrl-tab.
Rackle,
I dropped this code into my project. It compiled/built without modification. I then instantiated a TabNavigation object within one of my dialogs, set the parent window, added a handful of widgets, and voila I have tab navigation working.
You da man.
Now a couple of questions:
1] Is there any intent to pull a class such as this into the CEGUI baseline? It seems like something such as this should be.
2] Looking at the code you reference macros that you call: HACKED_FOCUS_LOSS, HACKED_FOCUS_GAIN. These macros seem to do exactly what I would hope that they do "they highlight the window that has the focus based on the tab control". Why are these "HACKED" from your perspective? I'm assuming that this is because you feel there is a better way to handle focus. Please elaborate.
Thanks for this class. I will continue to use it.
I dropped this code into my project. It compiled/built without modification. I then instantiated a TabNavigation object within one of my dialogs, set the parent window, added a handful of widgets, and voila I have tab navigation working.
You da man.
Now a couple of questions:
1] Is there any intent to pull a class such as this into the CEGUI baseline? It seems like something such as this should be.
2] Looking at the code you reference macros that you call: HACKED_FOCUS_LOSS, HACKED_FOCUS_GAIN. These macros seem to do exactly what I would hope that they do "they highlight the window that has the focus based on the tab control". Why are these "HACKED" from your perspective? I'm assuming that this is because you feel there is a better way to handle focus. Please elaborate.
Thanks for this class. I will continue to use it.
The better way would be for the scheme to have different imagery for this state. For example a pushbutton should display a dotted square around the text or image. That same dotted square should be displayed around an image, around the text of a checkbox or radio button.
As far as being within Cegui itself well it sort of is, from the Wiki. Maybe there could be an add-on folder that contains these various features with the download.
As far as being within Cegui itself well it sort of is, from the Wiki. Maybe there could be an add-on folder that contains these various features with the download.
-
- Not too shy to talk
- Posts: 23
- Joined: Sat Mar 03, 2007 22:54
Hi there. This looks very useful.
I want fast user entry for a series of input boxes, with OK buttons.
Would it be possible to use this code so that when an entry box has focus, hiting return will be the same as pressing the OK button used submit the entry, and move focus to the next entry box? Bassicaly, so the user can type, press enter, type in the next box, press enter, and so on.
Any tips on how to go about doing that would be much appreciated.
I want fast user entry for a series of input boxes, with OK buttons.
Would it be possible to use this code so that when an entry box has focus, hiting return will be the same as pressing the OK button used submit the entry, and move focus to the next entry box? Bassicaly, so the user can type, press enter, type in the next box, press enter, and so on.
Any tips on how to go about doing that would be much appreciated.
I've been working for a database company for over ten years. A major part of my job is creating new windows to input data. At first we validated the data when the user left a field, preventing wrong data from being entered. Through user feedback we've changed our approach to validate when the user presses the ok/save button. If there's an error we display an error message and put the focus back into the field. With this approach users can enter the fields in any order they whish.
Back to your question. Each widget listens for a tab or shift-tab keyboard event, which calls the _onCharacterKey() function. You could check for the enter key (both on the main and the numeric keypads). At that time you could call your validation function and if you find that everything's ok then you "save" that data and inject a tab keyboard event, to activate the widget navigation code and move to the next widget.
Back to your question. Each widget listens for a tab or shift-tab keyboard event, which calls the _onCharacterKey() function. You could check for the enter key (both on the main and the numeric keypads). At that time you could call your validation function and if you find that everything's ok then you "save" that data and inject a tab keyboard event, to activate the widget navigation code and move to the next widget.
-
- Not too shy to talk
- Posts: 23
- Joined: Sat Mar 03, 2007 22:54
Yeah, what scriptkid said. Within the _onCharacterKey() function you know which editbox you are in.
The way I pictured your .layout is multiple rows each containing an editbox and an Ok pushbutton on its right. Maybe that's not what you meant, maybe you meant that you have 10 editboxes and one Ok button? If that's the case then have a look at DialogSystem. That's designed to facilitate user entry.
The way I pictured your .layout is multiple rows each containing an editbox and an Ok pushbutton on its right. Maybe that's not what you meant, maybe you meant that you have 10 editboxes and one Ok button? If that's the case then have a look at DialogSystem. That's designed to facilitate user entry.
-
- Not too shy to talk
- Posts: 23
- Joined: Sat Mar 03, 2007 22:54
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 3 guests