Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Filter ComboBox content prior to its expansion
Filter ComboBox content prior to its expansion [message #1404548] Mon, 04 August 2014 05:35 Go to next message
Janusz Dalecki is currently offline Janusz DaleckiFriend
Messages: 60
Registered: January 2010
Location: Sydney
Member
Hi,
I am trying to implement a JFace ComboBox that very first time (when user did not select anything yet) displays a text inside it: "<Select>". When the user clicks on combo box to expand it, I want to display a list of files from some pre-defined directory (I know how to do that) but not the string "<Select>" (I don't know how to do that how to remove the first element <Select> prior to combo box expansion).
Any help appreciated.
Regards,
Janusz
Re: Filter ComboBox content prior to its expansion [message #1404554 is a reply to message #1404548] Mon, 04 August 2014 07:40 Go to previous messageGo to next message
Hussein MHANNA is currently offline Hussein MHANNAFriend
Messages: 45
Registered: February 2014
Location: LAVAL
Member
Hi,

If your combox isn't read-only (without SWT.READ_ONLY style), then you can use Combo#setText(String) method to set the default text.

If your combobox is read-only, then

1. Add the "<Select>" by default in your input of the comboviewer
2. Add a FocusListener to the combo and override the method focusGained to reset the input without the "<Select>".

regards,

Hussein


ALL4TEC
Re: Filter ComboBox content prior to its expansion [message #1404562 is a reply to message #1404554] Mon, 04 August 2014 08:02 Go to previous message
Janusz Dalecki is currently offline Janusz DaleckiFriend
Messages: 60
Registered: January 2010
Location: Sydney
Member
Thanks a lot Hussein,
Works like a charm.
Regards,
Janusz
Previous Topic:How to trigger ICellModifier 's modify()?
Next Topic:TableViewer with ILazyContentProvider does not remove elements
Goto Forum:
  


Current Time: Mon Nov 19 09:50:28 GMT 2018

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

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

Back to the top