| Summary: | SWT should support a tri-state check box | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Olaf Kindel <ok2> | ||||||||||||||
| Component: | SWT | Assignee: | Steve Northover <snorthov> | ||||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||||
| Severity: | enhancement | ||||||||||||||||
| Priority: | P3 | CC: | alamothe, arnaud.chassagne, bogofilter+eclipse.org, bradleyjames, chs, cocoakevin, daniel.kruegler, eclipse.felipe, eclipse, evgeniyos, hudsonr, IngedevTeam.fr, mark.melvin, mlists, mm, mseele, oleg.krasilnikov, pombredanne, rohit_1004, roman.porotnikov | ||||||||||||||
| Version: | 2.0 | Keywords: | helpwanted | ||||||||||||||
| Target Milestone: | 3.4 M5 | ||||||||||||||||
| Hardware: | All | ||||||||||||||||
| OS: | All | ||||||||||||||||
| Whiteboard: | |||||||||||||||||
| Bug Depends on: | |||||||||||||||||
| Bug Blocks: | 182450 | ||||||||||||||||
| Attachments: |
|
||||||||||||||||
|
Description
Olaf Kindel
We frequently get requests for new widgets which would be valuable to some set of Eclipse users but not all of them. Since we are a small team, we typically focus only on implementing widgets which are required by the Eclipse UI team. One way for you to proceed would be to convince the Eclipse UI developers that they want this widget. Alternatively, you (or someone else in the community) could implement a widget like this and submit it via the platform-swt-dev mailing list. We could then look at including it in the SWT distribution. For this to happen, the code would have to be of high quality, and include both platform specific implementations on platforms which support it, and a generic implementation (i.e. a custom widget) for use on platforms which do not. Moving from Later. *** Bug 59865 has been marked as a duplicate of this bug. *** If the intermediate state is not been implemented, it would be helpful if it was possible to get a handle on the composite the check appears in, to change it's foreground and background colour to imitate this behaviour through a selection Listener. Regards, Anthony Bennis. Created attachment 27940 [details]
Windows Folder Attributes
Dialog from windows explorer showing multiple selection with mixed values.
Created attachment 27941 [details]
Display Properties/Effects
Windows Display Properties/Effects dialog showing partially enabled setting
Created attachment 27942 [details]
FrontPage Table Cell Properties
Dialog in MS FrontPage showing attribute with mixed values in multiple select
case.
Created attachment 45177 [details]
Tristate check box
for the meantime, I attached a TristateButton class for the people who can't wait - it's not perfect but sure does the job for me. enjoy!
*** Bug 154187 has been marked as a duplicate of this bug. *** Are there any plans to implement this support in SWT? I have been using the example provided on Windows and it works well, but now we are looking at Linux support and I currently don't have a good solution for it. Created attachment 65176 [details]
TriButton: possible implementation of 3-state control.
TriButton class is not platform-specific.
It can look like either checkbox (compatibility mode)
or combo box with text label (3-state mode, default).
Combo contains 3 choices: Yes, No, ?.
Most existing Button's methods are preserved,
so it's possible simply to replace "Button"
with "TriButton" in existing code.
2 new methods added:
public int getTriSelection ();
public void setTriSelection(int selection);
Currently class is located in CDT and used from it,
but it can be moved anywhere, since it depends of
SWT only.
Created attachment 65206 [details]
Non-Windows-specifc version of Klaus Wenger's class
For completeness, here is a copy of the code we ended up with. One of our guys took Klaus Wenger's version posted earlier and made it compile and work on Linux or Windows.
I have not tried the CDT version, but it sounds interesting and is probably a better solution. I'm not sure what it looks like though. This code *looks* native, but has only been tested on Windows and Linux/GTK.
Comment on attachment 65206 [details]
Non-Windows-specifc version of Klaus Wenger's class
So much for "auto-detect" of attachment type...
Thanks to Mark. It works !!! The only feature of the latest attach: New control is derived from SWT.Button, so it can always be in SWT package, otherwise it would not work. So stand-alone developer cannot distribute it in own package. It would be very useful to place it to custom widgets directory. "Eclipse SWT Custom Widgets\common\org\eclipse\swt\custom\" Is it possible ? Fixed > 20080114 See Button.getGrayed() and Button.setGrayed(). Sweet... It doesn't work for me. The user can still observe just two states. After setGrayed(true), these states are unchecked and grayed from a user perspective, or unchecked and checked from a developer perspective. getGrayed() always returns true after setGrayed(true). This behaviour is not consistent with that of Windows' tristate checkbox (I don't think it can be considered tristate at all) I'm using Eclipse 3.4.1 and Windows XP |