PDA

View Full Version : How to be notified of Selection changes?



chillhelm
October 20th, 2022, 12:07
Hi everyone,

I was wondering if there is any API functionality to get notified of selection changes.
I would love something like imagecontrol.onSelectionChanged(...) or tokeninstance.onSelect(...). Nothing like this is documented in the API, but the doc is sometimes behind what is actually available. AFAIK selection state is also not stored in the DB, so DB.addHandler(...,"onUpdate",...) won't help either.

Failing that, what would be good opportunities to poll imagecontrol.getSelectedTokens to check for changes myself? tokeinstance.onClickRelease does not work, since the selection is updated only after the click event is fully processed. Same goes for imagecontrol.onCursorModeChange (again imagecontrol.getSelectedTokens gives the old selection).

The only other thing I could think of would be to use imagecontrol.onHover and tokeninstance.onHover, but that will be a lot of polls, comparing possibly large tables. I'm worried about the performance impact here.

Anyone have an idea or suggestion?

Moon Wizard
October 20th, 2022, 20:33
There are no events in the API for this UI action.

Regards,
JPG