[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: SWT Mouse event

That's a good way.

Another way - if the array is constant - is to tell each button what its 
index is, using button.setData(new Integer(index)).
Then when you get the mouse down event you can use event.widget.getData() to 
figure out the index.

Carolyn

"Tom Schindl" <tom.schindl@xxxxxxxxxxxxxxx> wrote in message 
news:fsso1h$tc0$1@xxxxxxxxxxxxxxxxxxxx
> Looping through them and checkin event.widget == button[i]?
>
> Tom
>
> Swetha schrieb:
>> Hi All,
>>
>>    I have placed array of buttons in UI..like button[0],button[1] etc.. 
>> upto 10..
>>
>> and added a listener to all the buttons in a for loop ...
>>
>> In mouse down event how can get the index of the button I clicked...
>>
>> Thanks,
>> Swetha
>>
>
>
> -- 
> B e s t S o l u t i o n . at
> --------------------------------------------------------------------
> Tom Schindl                                          JFace-Committer
> --------------------------------------------------------------------