Jump to content


Photo

[idea] SysLink via Html


  • Please log in to reply
1 reply to this topic

#1 Learning one

Learning one
  • Members
  • 1295 posts

Posted 04 December 2011 - 09:53 PM

EDIT: this is made obsolete by AutoHotkey_L v1.1.06.01 which implemented SysLink control, but it is still nice if you need links + formatting.
___________________________

Posted Image
html = 
(
<html>
<style>
span.FakeLink{color:blue; text-decoration:underline; cursor:pointer;}
span.Red{color:red; font-weight:bold;}
span.Green{color:green; font-weight:bold;}
body{margin:4px; font-family:Arial, Helvetica, sans-serif; font-size:12; overflow:visible; background-color:#ffffcc; text-align:justify}
</style>

<body>
<p>By using <i>Html</i> and <i>ActiveX</i>, you can easily mimic <i>SysLink</i> controls. Use <i>fake links</i> to execute AHK code; <span id="FakeLink1" class="FakeLink">fake link 1</span> or <span id="FakeLink2" class="FakeLink">fake link 2</span>. Launch <i>URLs</i>; visit <a href="http://www.autohotkey.com/forum/">AutoHotkey forum</a> and <a href="http://www.autohotkey.com/docs/Tutorial.htm">quick-start tutorial</a>.  And of course, format your text; <b>bold</b>, <i>italic</i>, <span class="Red"> red</span>, <span class="Green"> green</span>, etc.</p>
</body>
</html>
)

Gui, Add, ActiveX,  x2 y2 w400 h80 voHtml, HtmlFile
oHtml.write(html)
ComObjConnect(oHtml, "oHtml_")
Gui, Show, w404 h84, [idea] SysLink via Html 
Return

GuiClose:
ExitApp

oHtml_OnClick(oHtml) {
	id := oHtml.parentWindow.event.srcElement.id
	if id contains FakeLink
		MsgBox,,, You clicked on: %id%, 1	; put your action here
}
See also: SysLink by just me and HLink in Forms Framework by majkinetor.

#2 fragman

fragman
  • Members
  • 1591 posts

Posted 05 December 2011 - 12:00 AM

Sounds like a good idea as the SysLink32 control isn't properly usable in AHK due to issues with WM_NOTIFY. I'll keep that in mind when I need it so I can integrate a wrapper in CGUI.