80 views
in GUI Development by
Hi,

Attaching one action for one key is done as reference, similarly same key should attach different actions based on the selected item in the vertical list. So that respective action attached based on selected item should take place when the key is pressed, also other actions for the same key should be detached.

Is it possible to achieve this or is there any alternate solutions for this case?

Thank you.

1 Answer

0 votes
by

Hello Meenakshi Sundaram,

I have to admit that I don't really understand your question. Especially the part with ' ... other actions for the same key should be detached' is not clear what you try to achieve. If you want different operations to be performed on the same key event but depending on the selected item, following are the possibilities:

Option 1: handle the key events in the components implementing the items. Then each component can perform the operation which is related to it. The selection in the list relays the keyboard events to the selected item automatically. This expects that the list itself is focused. See also Keyboard events and the focus path.

Option 2: in the slot method associated to the key event handler test which item is actually selected and depending on this information perform the desired operation. See also the list property SelectedItem to query the current selection.

I hope it helps you further.

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint

...