Sublime Forum

How can I pass modifier_keys from a ListInputHandler to the command that uses the list input?

#1

Hi,

How can I pass modifier_keys from a ListInputHandler to the command that uses the ListInputHandler?

Here is my structure:

  1. I have a ListInputHandler subclass called JobInputHandler. The class receives an event dict for the validate and confirm method (want_event method returns True. In the validate and confirm method, I can check whether any modifier keys where pressed when the user selected an item in the list.

  2. I have a WindowCommand called TestCommand that returns JobInputHandler from the input() method. So the user will be prompted for an input before the command is run.

My question: In the run() method of TestCommand, I would like to know whether the item in JobInputHandler was selected with a modifier keys. What is the best way to pass the modifier keys from the ListInputHandler to the WindowCommand that uses the ListInputHandler as input?

Thanks!

0 Likes

#2

When it comes to passing information between chained input handlers or from the triggering command to the hander, it’s easy as you simple pass any data and intialize it in __init__. When it comes to passing some different data from the handler back to the command, I don’t see a clean way of doing it other than to maintain some global plugin state (via a global variable) and then using it.

But maybe the package/plugin experts can correct me.

0 Likes