[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Definition of Traversal Event

Traverse can occur on any control that can take keyboard focus.
The event is sent when the user types any of the traversal keys: Escape, 
Return, Tab, Shift+Tab, Control+Tab, arrow keys, Alt+mnemonic, or 
PageUp/PageDown.
Typical traversal operations in some typical controls are: Escape closes a 
dialog, Return selects a default button in a dialog, tab moves to the next 
tab group, arrows move to the next tab item, mnemonics select or invoke the 
related control, and the page keys move between tabbed pages.
In the listener, the detail field of the TraverseEvent tells you which type 
of traversal key(s) the user typed (using SWT.TRAVERSE_* constants). The 
doit field lets you specify whether or not you want to allow that particular 
traversal to occur in your control. If you set doit to true, the traversal 
will occur and the corresponding keystrokes will not generate a key event. 
If you set doit to false, the traversal will not occur, and the keystroke(s) 
will be sent to the control in a key event. If you set doit to false and 
also want keystroke(s) to not go to a key event, you can set the detail to 
SWT.TRAVERSE_NONE.
If you are implementing a custom control by subclassing Canvas or Composite, 
then you must implement traversal so that users can traverse out of your 
custom control using the keyboard.

Some snippets that show adding a traverse listener to a control are:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet111.java?view=co
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java?view=co
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet21.java?view=co
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet248.java?view=co
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet4.java?view=co

Examples of custom controls that use traverse event are: CCombo, CTabFolder, 
StyledText.

Hope this helps,
Carolyn

"Didiot Alexandre" <nospam4alex@xxxxxxxxxxxxxx> wrote in message 
news:549cabb731807c27ca6c16e7b5f999a1$1@xxxxxxxxxxxxxxxxxx
> Hello,
>
> Could someone give me a general definition of the traversal event ?
> Or where I can find it.
> - When this event is triggered
> - Which SWT widget receives it
> - ..
>
> Thanks,
> Alexandre Didiot
>