Community
Participate
Working Groups
Description copied from http://swtbot.org/bugzilla/show_bug.cgi?id=139: It would be useful to be able to traverse controls using the keyboard with the bot API. A common use case is to enter text into a field and tab to set focus to the next field. (I need this for testing traversal ordering.) To accommodate this, I played with an added a method like this: public void typeKey(final char key) { log.debug(MessageFormat.format(?Inserting text:{0} into text {1}?, key, this)); setFocus(); notifyKeyboardEvent(SWT.NONE, key); } and calling it like this: text.typeKey(SWT.TAB); Unfortunately, this doesn?t do the trick. I also experimented with synthesizing a traverse event and sending it directly to the widget like this: Event event = new Event(); event.type = SWT.Traverse; event.time = (int) System.currentTimeMillis(); event.widget = projectName.widget; text.notify(SWT.Traverse, event); but no dice. (I didn?t entirely expect it to work but it was worth a try anyway.) Any ideas?
Fixed in trunk. Added some test cases SWTBot2#testTabKeyTraversalSetsFocusOnTheNextControlAndSendsTraverseEvents Phil would you want to try this out with some testcases of your own ?
Created attachment 121279 [details] mylyn/context/zip