Hi Ankit, Don't know how I missed that one.
Thanks for pointing this out. It's been fixed in trunk. -- Ketan On 04-Sep-08, at 4:49 PM, Jain, Ankit wrote: > Hi, > > I knew the hookControl() method for attaching > selectionChangeListener to ComboBox selectionListener. But the > problem was not due to this. It is because of the code in > org.eclipse.swt.widgets.Combo.java see the snippet: > > public void select (int index) { > checkWidget (); > int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0); > if (0 <= index && index < count) { > int selection = OS.SendMessage (handle, OS.CB_GETCURSEL, > 0, 0); > int code = OS.SendMessage (handle, OS.CB_SETCURSEL, > index, 0); > if (code != OS.CB_ERR && code != selection) { > sendEvent (SWT.Modify); -- it is for > Combo.addModifyListener not for Combo.addSelectionListener > // widget could be disposed at this point > } > } > Due to which It was not calling the selectionListener for this event. > > I did following changes in net.sf.swtbot.widgets.SWTBotCombo.java, > please let me know will it cause some damage or is it fine: > > public void setSelection(final int index) { > checkEnabled(); > int itemCount = itemCount(); > if (index > itemCount) > throw new RuntimeException("The index (" + index + > ") is more than the number of items (" + itemCount + ") in the > combo."); > > asyncExec(new VoidResult() { > public void run() { > getCombo().select(index); > } > }); > Notify(SWT.Selection); // changes I did > } > > > _________________________________________________________ > > Ankit Jain / Capgemini "India" / Bangalore > Consultant/ Sogeti > Com1: 080-6656700- extn: 8473 Com2: +919986017572 / www.capgemini.com > Together. Free your energies > _________________________________________________________ > > > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > ] On Behalf Of Ketan Padegaonkar > Sent: Wednesday, August 27, 2008 7:39 PM > To: swtbot-users@lists.sourceforge.net > Subject: Re: [SWTBot-users] Selection Listener not working > > > On 27-Aug-08, at 7:04 PM, Jain, Ankit wrote: > > > Hi All, > > > > I found the reason why the code below is not working. > > > > It is because The listener added to Comboviewer object not to Combo. > > Therefore it is not working. > > > AFAIK ComboViewer (or any other viewer) does a hookControl(Control) > which adapts the SWT's SelectionListener to JFace's > SelectionChangedEvent. So listeners hooked into Combo or ComboViewer > should continue to work. JFace merely translates SWT events into JFace > events. > > I may be wrong so I'd recommend going through the hookControl that's > invoked in the ComboViewer's constructor. > > You could add a breakpoint into the anonymous SelectionListener inside > hookControl() > > -- Ketan > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > SWTBot-users mailing list > SWTBot-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/swtbot-users > http://swtbot.org/ - a functional testing tool for SWT/Eclipse > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________ > SWTBot-users mailing list > SWTBot-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/swtbot-users > http://swtbot.org/ - a functional testing tool for SWT/Eclipse > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ SWTBot-users mailing list SWTBot-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/swtbot-users http://swtbot.org/ - a functional testing tool for SWT/Eclipse