Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Prevent ESC from closing a Dialog(ESC Key closes an application_modal shell (obviously per default))
Prevent ESC from closing a Dialog [message #1858217] Thu, 23 March 2023 09:59 Go to next message
Daniel Stieger is currently offline Daniel StiegerFriend
Messages: 24
Registered: April 2010
Junior Member
Gentlemen,

i am evaluating the RWT a bit. I m just wondering why ESC closes a new Shell/Dialog per default. Maybe that s just a simple question...

BTW: the gridData.hightHint ist not working for the Text Widget. I just wanted to make it MultiLine with a height of 5 lines .... This is also probably just related to how one should handle things with the RWT.

Shell dialog = new Shell(parent.getShell(), SWT.APPLICATION_MODAL);

                dialog.setMinimumSize(parent.getShell().getSize().x - 200, 0);
                dialog.setLocation(100, 0);
                dialog.setLayout(new GridLayout(1, false));

                Text t = new Text(dialog, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
                GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
                gridData.heightHint = 50;
                t.setText("USE CRTL for a MNEMONIC demo ...  or crtl+x ESC or d to check for hotkey handling");

                Button closeButton = new Button(dialog, SWT.NONE);
                closeButton.setText("&E Close");
                closeButton.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        dialog.close();
                    }
                });

                dialog.setData(RWT.CANCEL_KEYS, new String[]{"ESC"});
                dialog.setData(RWT.ACTIVE_KEYS, new String[]{"CTRL+X"});
                dialog.addKeyListener(new KeyListener() {
                    @Override
                    public void keyPressed(KeyEvent keyEvent) {
                        t.setText("Key Event here " + keyEvent) ;
                        keyEvent.doit = false;
                    }

                    @Override
                    public void keyReleased(KeyEvent keyEvent) {

                    }
                });

                dialog.pack();
                dialog.open();



Any suggestion or hint appreciated,
Daniel
Re: Prevent ESC from closing a Dialog [message #1858222 is a reply to message #1858217] Thu, 23 March 2023 14:40 Go to previous messageGo to next message
Daniel Stieger is currently offline Daniel StiegerFriend
Messages: 24
Registered: April 2010
Junior Member
The
gridData.heightHint() 
is working of course !

Just dont forget to call
t.setLayoutData(gridData)  
: )
Re: Prevent ESC from closing a Dialog [message #1858324 is a reply to message #1858222] Wed, 29 March 2023 06:01 Go to previous messageGo to next message
Daniel Stieger is currently offline Daniel StiegerFriend
Messages: 24
Registered: April 2010
Junior Member
Short update for those wondering how to prevent a dialog to close...

 
dialog.addListener(SWT.Close, new Listener()
                {
                    public void handleEvent(Event event)
                    {
                        t.setText("This was the dialog.listener()");
                        event.doit = false;
                    }
                });


The RWT is just an amazing piece of work. It seems to be very fast (e.g. tables) and very consistent in how things are handled !
Re: Prevent ESC from closing a Dialog [message #1858336 is a reply to message #1858324] Wed, 29 March 2023 12:09 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,

thank you for the kind words. I was more than 15 years we are developing the RWT framework. Such a positive feedback motivates us to continue supporting and extending it.

Best regards,
Ivan
Previous Topic:Is RAP still heavily in use - or are there other stacks recommended?
Next Topic:Table's Cell and padding
Goto Forum:
  


Current Time: Thu Jun 20 15:41:34 GMT 2024

Powered by FUDForum. Page generated in 0.03138 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top