Home » Eclipse Projects » Remote Application Platform (RAP) » E-Mail link
E-Mail link [message #656326] |
Fri, 25 February 2011 01:59  |
Eclipse User |
|
|
|
Hi,
I want to create a e-mail link widget, like following code:
Link link = new Link(tb, SWT.NONE);
link.setText("<a href=\"mailto:alphax@vip.163.com\">alphax</a>");
link.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
int style = ExternalBrowser.LOCATION_BAR
| ExternalBrowser.NAVIGATION_BAR
| ExternalBrowser.STATUS;
String url = "mailto:alphax@vip.163.com";
ExternalBrowser.open( "mailToAlphax", url, style );
}
});
But this code will open an new empty browser window, and then invoke the e-mail client. What I want just invoke the mail client when the user click on the link, How to achieve this?
Need your help, thanks!
|
|
|
Re: E-Mail link [message #656343 is a reply to message #656326] |
Fri, 25 February 2011 03:24   |
Eclipse User |
|
|
|
Hi,
to avoid the new browser window you can use a Browser widget. Set the
text to it like Browser#setText( "<a
href=\"mailto:alphax@vip.163.com\">alphax</a>" );. You can use the <a>
inline "style" attribute to change the look of the link (font, color...).
HTH,
Ivan
On 2/25/2011 8:59 AM, Yau wrote:
> Hi,
>
> I want to create a e-mail link widget, like following code:
>
> Link link = new Link(tb, SWT.NONE);
> link.setText("<a href=\"mailto:alphax@vip.163.com\">alphax</a>");
> link.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
> false));
> link.addSelectionListener(new SelectionAdapter() {
>
> @Override
> public void widgetSelected(SelectionEvent e) {
> int style = ExternalBrowser.LOCATION_BAR
> | ExternalBrowser.NAVIGATION_BAR
> | ExternalBrowser.STATUS;
>
>
> String url = "mailto:alphax@vip.163.com";
> ExternalBrowser.open( "mailToAlphax", url, style );
> }
> });
>
>
> But this code will open an new empty browser window, and then invoke
> the e-mail client. What I want just invoke the mail client when the
> user click on the link, How to achieve this?
>
> Need your help, thanks!
|
|
| | |
Re: E-Mail link [message #656515 is a reply to message #656380] |
Fri, 25 February 2011 22:38   |
Eclipse User |
|
|
|
Thanks Ivan,
I use this email link in the status line, if use Browser widget, I want it act as the Link widget, just draw a single line text but without scroll bar.
As the code as below, even I have specified SWT.NO_SCOLL as the browser style, but the code produce an small scroll bar, and the scroll bar occupied the all space so that the link text is invisible.
StatusLineContributionItem.fill(...) {
Composite panel = new Composite(parent, SWT.NONE);
panel.setLayout(new GridLayout(3, false));
Label label = new Label(panel, SWT.NONE);
label.setText("Copy right");
label.setLayoutData(new GridData(SWT.LEAD, SWT.CENTER, false, false));
Browser browser = new Browser(panel, SWT.NO_SCROLL);
browser.setText("<a href=\"mailto:alphax@vip.163.com\">alphax</a>");
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
label = new Label(panel, SWT.NONE);
label.setText("2011");
label.setLayoutData(new GridData(SWT.TRAIL, SWT.CENTER, false, false));
}
[Updated on: Fri, 25 February 2011 22:40] by Moderator
|
|
| | |
Goto Forum:
Current Time: Tue Jul 08 03:39:26 EDT 2025
Powered by FUDForum. Page generated in 0.07123 seconds
|