Community
Participate
Working Groups
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.
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.
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.
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.
Note: Cocoa has the icon there.
... and shouldn't. Please remove it for now as I suspect it does nothing.
Felipe, I am not going to be able to get to this.
(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.)
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.
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.
That's the next step but it is likely to be a hint.
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.
>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.