Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Right-aligning background image in SWT Text
Right-aligning background image in SWT Text [message #909757] Fri, 07 September 2012 18:13 Go to next message
Ronald So is currently offline Ronald SoFriend
Messages: 198
Registered: April 2011
Senior Member
Hi,

I have a text box that I want to put an image as the background of a Text widget.The image has to be right-aligned, i.e. show up on the far right inside the Text widget.

Desired behavior: index.php/fa/11416/0/

I tried the following CSS setting but I see the image repeatedly shown up in the Text widget area.

Behavior now: index.php/fa/11415/0/

Text.search {
    background-image: url( icons/icon_search.png ) no-repeat right center;
}


I know the "no-repeat" and the right center attributes are not documented in the Eclipse documentation. If I don't remember incorrectly, this is how to do it with CSS. Is this behavior supported by RAP? Is there any alternatives that I can try within the boundary of RAP?

Thanks,
Ronald
Re: Right-aligning background image in SWT Text [message #909763 is a reply to message #909757] Fri, 07 September 2012 18:23 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Roland,
in RAP 2.0M1 we added support for SWT.ICON_SEARCH flag in Text widget. See:
http://www.eclipse.org/rap/noteworthy/2.0/?build=M1
Best,
Ivan

On 9/7/2012 9:13 PM, Ronald So wrote:
> Hi,
>
> I have a text box that I want to put an image as the background of a Text widget.The image has to be right-aligned, i.e. show up on the far right inside the Text widget.
>
> Desired behavior:
>
> I tried the following CSS setting but I see the image repeatedly shown up in the Text widget area.
>
> Behavior now:
>
>
> Text.search {
> background-image: url( icons/icon_search.png ) no-repeat right center;
> }
>
>
> I know the "no-repeat" and the right center attributes are not documented in the Eclipse documentation. If I don't remember incorrectly, this is how to do it with CSS. Is this behavior supported by RAP? Is there any alternatives that I can try within the boundary of RAP?
>
> Thanks,
> Ronald
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Right-aligning background image in SWT Text [message #909765 is a reply to message #909763] Fri, 07 September 2012 18:30 Go to previous messageGo to next message
Ronald So is currently offline Ronald SoFriend
Messages: 198
Registered: April 2011
Senior Member
OMG Ivan.

"SWT.ICON_SEARCH and SWT.ICON_CANCEL support for Text widget" is exactly what I need in RAP 1.5. Is there a way I can accomplish that within 1.5? We can't possibly move to 2.0 before shipping our first release.

Thanks,
Ronald

Re: Right-aligning background image in SWT Text [message #909801 is a reply to message #909765] Fri, 07 September 2012 20:33 Go to previous messageGo to next message
Cole Markham is currently offline Cole MarkhamFriend
Messages: 150
Registered: July 2009
Location: College Station, TX
Senior Member

Ronald,

As a workaround, you can add a separate composite to hold your icon. Add both the text field and image to a wrapper composite and use absolute positioning to put the icon on top of the text widget. You may need a resize listener to make sure they get adjusted if your layout can be resized. Or you could put them side by side if that is acceptable.

Hope that helps,

Cole
Re: Right-aligning background image in SWT Text [message #909832 is a reply to message #909801] Fri, 07 September 2012 22:01 Go to previous messageGo to next message
Ronald So is currently offline Ronald SoFriend
Messages: 198
Registered: April 2011
Senior Member
Thanks Cole for the workaround. It does seem like this is the best option for now unless the 2.0 feature gets back-ported.

Ronald
Re: Right-aligning background image in SWT Text [message #909966 is a reply to message #909832] Sat, 08 September 2012 07:32 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

> Thanks Cole for the workaround. It does seem like this is the best
> option for now unless the 2.0 feature gets back-ported.

New features won't be backported, only bugfixes. That's our policy to
guarantee that upgrading to a service release involves minimal risk.

Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:RWT Exception after Refresh of the current page
Next Topic:com.google.gson doesn't work with RAP
Goto Forum:
  


Current Time: Fri Apr 26 06:41:48 GMT 2024

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

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

Back to the top