Skip to main content
Known Participant
August 18, 2009
Answered

[CS2/CS3] - Mouse wheel & key down events in Listbox

  • August 18, 2009
  • 1 reply
  • 2158 views

Hello,   I'm using a dialog for displaying ListBox with elemets. Is there any possibility of working arrows (up/down) to navigate in ListBox or use Mouse wheel ?  I tried to connect eventHandler to dialog and I was able to get events connected with mouse (f.e. LButtonDn, ...), but my overrided method MouseWheel & KeyDown are not working ?  Thank you for you answers !

This topic has been closed for replies.
Correct answer

You was right, reaction on arrows, pageUp/Down and also wheel work without any problems. My problem is that my Plugin has opened window with Indesign document and also dialog window with listBox. When I click on my ListBoxItem, there is in observer reaction that mark part of document with this method calling: textSelectionSuite->SetTextSelection(storyRef, rangeData, Selection::kScrollIntoView, nil);  This selectin set selection(focus) to Indesign window, please how could I set back active focus to my dialog window & ListBox ?  Thank you


IPanelControlData-> SetKeyboardFocus(). To get the window back to the front, you may have to write platform specific code, but look at IPanelMgr - I'm not sure that dialogs are part of the window list.

Anyway what you are doing sounds more to me like something that should be on a panel. Or perhaps you should collect the selections the user does in your listbox and apply them, when the dialog is close. This way you can also get a Cancel button on your dialog. Just suggestions ....

1 reply

August 18, 2009

Have you implemented a shadow eventhandler on the listbox, where you trap the events you are interested in ?

marxinAuthor
Known Participant
August 18, 2009

I have added handler to my ListBox:

Class  {

   kErrorsListBoxWidgetBoss,    kWidgetListBoxWidgetNewBoss,<br/>

{           IID_IEVENTHANDLER,    kErrorListEventHandlerImpl,       }<br/>

}<br/>

, and there is code of my event handler:<br/>

class ErrorListEventHandler : public CEventHandler<br/>

{ public:<br/>

   ErrorListEventHandl er(IPMUnknown * boss) : CEventHandler(boss) {} <br/>

   virtual ~ErrorListEventHandler() {}    virtual bool16 LButtonDn(IEvent *e);<br/>

    virtual bool16 KeyCmd(IEvent *e);    virtual bool16 MouseWheel(IEvent *e);<br/>

    virtual bool16 GetKeyFocus(IEvent *e); <br/>

}<br/>

<br/>  and I want to get events for scrolling mouse and keys up and down, but only LButtonDn event is working ?

marxinAuthor
Known Participant
August 21, 2009

IPanelControlData-> SetKeyboardFocus(). To get the window back to the front, you may have to write platform specific code, but look at IPanelMgr - I'm not sure that dialogs are part of the window list.

Anyway what you are doing sounds more to me like something that should be on a panel. Or perhaps you should collect the selections the user does in your listbox and apply them, when the dialog is close. This way you can also get a Cancel button on your dialog. Just suggestions ....


Thank you, it was only simple to return focus to dialog window with ListBox which native implements scrolling with mouse, PageUp/Down and arrows indeed.  Thanks