I have attached a ModifyListener to a Combo box and it works fine. But how do I trigger it through source code? Is there a better way than this?:
int selected = myCombo.getSelectionIndex();
myCombo.select(selected + 1);
myCombo.select(selected);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Programatically triggering a ModifyEvent in order to perform some GUI update (which I assume is what you’re trying to do) is not really a good design.
Better to split the functionality you want to call out into a separate function and call it directly. Something like this:
Any arguments you need to provide to your doSomething() method should be available without a ModifyEvent.
Hope this helps.