Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Handling enter pressed on TableEditor


Right!  How could I miss that?



Randy Hudson <hudsonr@xxxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

06/16/2005 09:47 AM

Please respond to
"Eclipse Platform SWT component developers list."

To
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
cc
Subject
Re: [platform-swt-dev] Handling enter pressed on TableEditor






You should also try using the widgetDefaultSelected() event.

Hang in there Steve! Just 2 more weeks! :-) :-)


-Randy




Steve Northover <Steve_Northover@xxxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

06/13/2005 11:43 AM

Please respond to
"Eclipse Platform SWT component developers list."

To
Vinicius Carvalho <java.vinicius@xxxxxxxxx>, "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
cc
Subject
Re: [platform-swt-dev] Handling enter pressed on TableEditor








Try using Display.asyncExec() to run your key pressed code after the text control has processed the key.  That should fix your problem.


Vinicius Carvalho <java.vinicius@xxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

06/13/2005 10:01 AM

Please respond to
Vinicius Carvalho and "Eclipse Platform SWT component developers list."


To
platform-swt-dev@xxxxxxxxxxx
cc
Subject
[platform-swt-dev] Handling enter pressed on TableEditor









Hello there! I'm a newbie on SWT. I have a table, where a column is
filled with Texts so the user can edit it. What I'd like to do is
after the user press enter button the item on the table gets updated.
I tried this:
text.addKeyListener(new KeyAdapter(){
                                       public void keyPressed(KeyEvent e) {
                 if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
                // fancy code ;)
                 }
                                       }
                      });

Well, from KeyEvent, I do have access to the source (the Text object)
but how do I access the item? I also tried:
text.addModifyListener(new ModifyListener(){
                                       public void modifyText(ModifyEvent e){
                                       //fancy code
                                       }
                      });

this time I can access the item, but it's called on every key press,
and I can't figure out when the user pressed enter, so I could
surround it by an if block.

Any suggestions?

Regards Vinicius
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top