I want to have a click on a MenuItem execute a link on the client, bypassing the server (ie, mailto: and tel: and sms: links)
In VWG this could done by registering a client action.
I saw a mailto: example here https://wisej.com/support/question/process-mailto-links-inside-htmlpanel-control but could not get it working.
On Android, this URL should bring up a new text message, with the body pre-filled: Application.Navigate(“sms:?body=testbody”)
The menu items in Wisej have an icon on the left (or icon space), the label, an optional keyboard shortcut, and the arrow to show the submenu. The label is only one component of the menu widget. It’s more than just a <div>.
It contains a new MenuItem class that has a new HRef property.
I looked at this some more, and came across something that maybe should have been more obvious. These links, defined as
MenuItem.Text = “<a href=””>Link Text</a>”
only apply the A HREF to the text part of the menu item, and not the entire rectangle area of the MenuItem. In order to activate the link, you have to click on the text part of the Menu item. Clicking the background area triggers nothing.
Is there a way to get the A HREF to apply to the entire area of the MenuItem?
Kind of works but the problem is that the owner element captures some low level event and closes the menu. If you tap on the menu item and keep it down for a bit longer you’ll see that it works. I’ll have a better solution for this, will update this post.
That’s good, I noticed you added those touch events and hope to look at them soon. I agree HREF would be the best way to launch these client-side links. Yes I checked the quotes, unfortunately I can’t get mailto: or sms: links working on Android, despite many attempts. I’ve tested it on Android 5.0.1 and also Android 6.0.1.
Attached is a test case for mailto, sms, and tel: links
I tried this on an iphone:
this.menuItem1.Text = “<a style=’color:inherit;text-decoration:inherit’ href=\’sms:test\’>menuItem1</a>”;
It works. Make sure you are using the straight single quotes. When copying from/to wordpress they are changed.
The best and safest way is to use href.
Cool, I forgot about using HTML in the .Text property. Is there anything else that has to be done? I couldn’t get any of these examples to work.
Me.mnuShareGmail.Text = “<span onclick=’window.open(“”mailto:firstname.lastname@example.org”)’>Send Email</a></span>”
Me.mnuShareGmail.AllowHtml = True
Me.mnuShareTextMsg.Text = “<span onclick=’window.open(” + Chr(34) + “sms:?body=testbody” + Chr(34) + “)’>Text Message</a></span>”
‘Me.mnuShareTextMsg.Text = “<a href=’sms:?body=testbody’>Text Message</a>”
Me.mnuShareTextMsg.AllowHtml = True
The HTML I am comparing it to is below. All these links work on Android 5.0.1
<a href=”sms:?body=testbody”>Android SMS</a>
<a href=’mailto:email@example.com’>Email with address filled</a>
<a href=’mailto:’>Email blank address</a>
<a href=’mailto:firstname.lastname@example.org?subject=Suggestions&body=Your’>Email all fields pre-filled</a>
<a href=’mailto:?subject=Suggestions&body=Your’>Email no recipient body pre-filled</a>
In any case, with Wisej you can always resort to HTML (VWG could display html content). You can do it with href (in this case you’d need to a <style> tag or a css file that styles the href elements, or with a <span>.
menuItem.Text=”<a href=’mailto:email@example.com’>Send Email</a>”; // you can add a style attribute or a add a<style> section to Default.html , or add a css file to Default.html.
menuItem.Text=”<span onclick=’window.open(\”mailto:firstname.lastname@example.org\”)’>Send Email</a>”;
In onclick you can put pretty much anything. Set AllowHtml to true to show the html.
Please login first to submit.