Sarah Weinberger
Sarah Weinberger

Reputation: 15561

Event notification if SWT Combo display list is visible

I was checking for an event that indicates if the Combo display list is open, but did not see anything.

I thought of a mouse down/up event hook, but I quickly realized that a user presses and releases the mouse to display the list. Also, one can use a keyboard.

I saw this article, which said to use the getListVisible() method, however that would either some sort of timer. A mouse up event is not quite accurate for implementing the check and a timer seems like major overkill for a simple task.

cboServers = new Combo(this.cmptLogHtsControl, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
cboServers.addMouseListener(new MouseAdapter()
{
    @Override
    public void mouseDown(MouseEvent arg0)
    {
    }
    @Override
    public void mouseUp(MouseEvent arg0)
    {
    }
});
gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
gridData.widthHint = 300;
cboServers.setLayoutData(gridData);
this.cboServers.addSelectionListener(new SelectionAdapter()
{
    @Override
    public void widgetSelected(SelectionEvent arg0)
    {
    }
});

Am I missing something? Thoughts?

Upvotes: 0

Views: 272

Answers (1)

greg-449
greg-449

Reputation: 111142

Since the popup is done by the native control there probably isn't any way to see this.

Looking at the implementation of Combo on Mac OS X getListVisible() is done using events which are specific to OS X and are not exposed in the SWT API.

Upvotes: 1

Related Questions