Home » Eclipse Projects » Remote Application Platform (RAP) » E-Mail link
E-Mail link [message #656326] |
Fri, 25 February 2011 06:59 |
KwanKin Yau Messages: 32 Registered: July 2009 |
Member |
|
|
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 08:24 |
Ivan Furnadjiev Messages: 2427 Registered: July 2009 Location: Sofia, Bulgaria |
Senior Member |
|
|
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 #656373 is a reply to message #656343] |
Fri, 25 February 2011 10:54 |
KwanKin Yau Messages: 32 Registered: July 2009 |
Member |
|
|
Thanks your advice, but the size of the browser widget is too large for my situation.
Is it possible add an "mailto" javascript to the respond stream to achieve an mail client invocation? I am not familiar with javascript.
[Updated on: Mon, 28 February 2011 08:01] Report message to a moderator
|
|
| |
Re: E-Mail link [message #656515 is a reply to message #656380] |
Sat, 26 February 2011 03:38 |
KwanKin Yau Messages: 32 Registered: July 2009 |
Member |
|
|
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: Sat, 26 February 2011 03:40] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Fri Sep 20 18:01:01 GMT 2024
Powered by FUDForum. Page generated in 0.03791 seconds
|