Question: In SWT is it possible to distinguish between events caused user interaction vs code?

Question

In SWT is it possible to distinguish between events caused user interaction vs code?

Answers 1
Added at 2016-11-06 21:11
Tags
Question

This example is using JRuby.

For example if I add listener to a Text widget like such:

add_modify_listener do |e|
    options = { event: e, r_value: r_value, source: self, is_interface_object: true, is_storeable: is_storeable? }
    presenter.send r_id, options
end

The listener is called if the user interacts with the widget or I programmatically set the value of the widget text. Is there any way to distinguish between the two potential triggers?

BTW, I know I can listen for different events ie (key events vs modify events), so I am not looking for a workaround, just if its possible to distinguish between the two triggers.

Answers
nr: #1 dodano: 2016-11-06 22:11

There isn't anything in a SWT Event that tells you where the event came from.

So, no, you can't tell how the event was generated.

Source Show
◀ Wstecz