Bug 260370 - Allow to show magnifier icon for Text with SWT.SEARCH
Summary: Allow to show magnifier icon for Text with SWT.SEARCH
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 260371 262345 262346
  Show dependency tree
 
Reported: 2009-01-08 05:38 EST by Dani Megert CLA
Modified: 2009-01-28 16:19 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2009-01-08 05:38:05 EST
3.5 M4.

It would be good to have API that enables the magnifier icon on a Mac search field (Text with SWT.SEARCH).

In order not to break clients we would need to control this with a separate style.
Comment 1 Steve Northover CLA 2009-01-08 17:10:19 EST
Originally, the SWT.SEARCH bit showed the search icon.  The feature was removed due to cheese and scroll problems.  We could look at adding it back.
Comment 2 Dani Megert CLA 2009-01-09 03:12:11 EST
And adding it automatically along with SWT.SEARCH could also "break" clients who already put an icon there manually - therefore we need an additional style bit.
Comment 3 Steve Northover CLA 2009-01-09 10:21:21 EST
I understand, however, there is a (weak) argument that clients should not attempt to add this functionality and assume that SWT.SEARCH has the necessary look.  The bottom line is that I agree with you and a new style bit is probably necessary.
Comment 4 Felipe Heidrich CLA 2009-01-15 12:51:25 EST
Note: Cocoa has the icon there.
Comment 5 Steve Northover CLA 2009-01-21 18:14:52 EST
... and shouldn't.  Please remove it for now as I suspect it does nothing.
Comment 6 Steve Northover CLA 2009-01-21 18:15:38 EST
Felipe, I am not going to be able to get to this.
Comment 7 Silenio Quarti CLA 2009-01-22 15:05:58 EST
(In reply to comment #5)
> ... and shouldn't.  Please remove it for now as I suspect it does nothing.
> 

Fixed, I also fixed the cancel button. Now cocoa only shows the cancel button if SWT.CANCEL is set.

For the main request in here, I'd suggest using SWT.ICON to indicate that the application wishes the magnifier icon to show. 
To have the search text field showing the icon and the cancel button the app can use:
new Text(parent, SWT.SEARCH | SWT.ICON | SWT.CANCEL)

where icon and cancel are both hints (only support on carbon and cocoa), in the other platforms these bits must be cleared to indicate to the application that the hint requested was no honored.

(p.s.: a bit bad using SWT.ICON cause it is only used in graphics till now.)
Comment 8 Steve Northover CLA 2009-01-22 15:18:15 EST
This seems ok to me.  I believe there was a cheese problem when the search icon is shown on carbon.  Also, before going ahead, we should ensure that Dani will actually use the functionality and that it will suite his needs.  

Current thinking:  When the search icon is pressed, it will send DefaultSelection and that is all.  There will be a detail code, similar to SWT.CANCEL that allows you to tell the difference between the user hitting return or the icon.
Comment 9 Dani Megert CLA 2009-01-23 02:52:25 EST
Of course even better would be to get the icon on every platform i.e. SWT draws the icon for me if the platform doesn't do so.
Comment 10 Steve Northover CLA 2009-01-23 11:33:25 EST
That's the next step but it is likely to be a hint.
Comment 11 Felipe Heidrich CLA 2009-01-23 13:06:25 EST
Fixed in HEAD > 20090123

We added the hints SWT.ICON_SEARCH and SWT.ICON_CANCEL (has the same value as SWT.CANCEL, nevertheless newly written code should use SWT.ICON_CANCEL with Text).

When platform doesn't support the hint is is cleared from the style.

see java doc of SWT.ICON_SEARCH, SWT.ICON_CANCEL and Text for more info.
Comment 12 Dani Megert CLA 2009-01-26 05:06:35 EST
>We added the hints SWT.ICON_SEARCH and SWT.ICON_CANCEL (has the same value as
>SWT.CANCEL, nevertheless newly written code should use SWT.ICON_CANCEL with
>Text).
I've updated the Platform UI code and filed bugs to fix it in PDE and in org.eclipse.swt.examples.