Links in WebLabel

I use a multiline weblabel which i fill from a database. Now i want to put links in the text. The links should trigger an event passing some information on to the eventhandler basically informing the handler which link was clicked. I tried using the coordinates from the mousedown event, but the differences in the way different browsers render the control make that option useless. I thought of using webhtmlviewer in which of course i could place links. But is it possible to intercept the clicks passing the link to the eventhandler.

I want to put in the label/htmlviewer Click here for Link 1 passing “Link1” to the event handler. although other methods of accomplishing this would be appreciated.

[quote=116873:@Ralf van de Ven]I use a multiline weblabel which i fill from a database. Now i want to put links in the text. The links should trigger an event passing some information on to the eventhandler basically informing the handler which link was clicked. I tried using the coordinates from the mousedown event, but the differences in the way different browsers render the control make that option useless. I thought of using webhtmlviewer in which of course i could place links. But is it possible to intercept the clicks passing the link to the eventhandler.

I want to put in the label/htmlviewer Click here for Link 1 passing “Link1” to the event handler. although other methods of accomplishing this would be appreciated.[/quote]

One way of intercepting clicks is instead of placing the actual link in there, you put hashtags. For instance:
#1
#2
#3
#4

Then use Session.Hashtagchanged to know which hashtag has been clicked, and through a dictionary or a two dimensions array fetch the corresponding link.

Look at the HTMLArea example in the WebSDK. I think that will do exactly what you want. The SDK is located in the Extras folder next to the app.

I was looking at the HTMLArea, but I couldn’t get it to work in my application. it doesn’t render the html i set. I set the HTML between open and shown events.

Was looking at that, but it would change the content of the htmlview.

A different question, how can i apply a webstyle on text inside webhtmlviewer or webarea.

You can’t. They’re strictly HTML.

That makes it rather difficult to use…
I was able to force rendering by putting a Me.HTML=Me.HTML in the Shown event.
Did find some issues. Webarea return illegal token on a CR and NL. Which can be fixed by a ReplaceAll

[quote=116899:@Michel Bujardet]One way of intercepting clicks is instead of placing the actual link in there, you put hashtags. For instance:
#1[/quote]

I replied to your first post request. As I wrote, this method does not change anything in the HTMLViewer, it does inform you about the link that was clicked. Then you take the action you want, and update the view with whatever you want according to the link being clicked. For instance load an html file corresponding to the option clicked.

How do you load the HTML in the HTMLViewer ? I tried saving the HTML as a file in specialfolder.temporary, then do

HTMLViewer1.URL = f.urlpath

and it works like a charm.

From what I can see, HTMLViewer being an iFrame does support CSS like the browser that is used to see the app, such as the page W3Schools Tryit Editor

It also works well with my own site which uses styles. It will work just as well with a local file.

I found some solutions. The rendering of the HTML was solved easy enough with a Me.html=Me.html in the shown event or slightly more elegant put the Executejavascript from html.set in the in the shown event. The problem was caused by me setting the html value before the shown event thus never sending it to the browser.

for the webstyle i changed the setuphtml event to return:
Return “<div class=”""+me.Style.Name+""" id=""" + Self.controlid + “”"" + sty + “>” + ProcessHTML(html) + “”

and removed the padding from the style(0).

Thanks to Greg for pointing me in the right direction and to Michel for his input