だから私はこのクールさを盗みPopupComposite
ました、そして私はそれに本当に満足しています.
1つだけ問題があります。が入っている場合はorg.eclipse.swt.widgets.Text
、ポップアップを開き、 にフォーカスしてText
を押すと、と のESC両方が破棄されます。Text
PopupComposite
Dispose 呼び出しがどこから来ているのか、本当にわかりません。それはShell
問題ですか?Shell
ポップアップには何を使用すればよいですか?
SSCCE :
/**
*
* @author ggrec
*
*/
public class PopupCompositeTester
{
public static void main(final String[] args)
{
new PopupCompositeTester();
}
private PopupCompositeTester()
{
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
createContents(shell);
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if ( !display.readAndDispatch() )
display.sleep();
}
display.dispose();
}
private static void createContents(final Composite parent)
{
final Button button = new Button(parent, SWT.PUSH);
button.setText("Poke Me");
final PopupComposite popup = new PopupComposite(parent.getShell());
new Text(popup, SWT.NONE);
popup.pack();
button.addSelectionListener(new SelectionAdapter()
{
@Override public void widgetSelected(final SelectionEvent e)
{
popup.show( Display.getDefault().map(parent, null, button.getLocation()) );
}
});
}
}