dummzeuch 1515 Posted April 19, 2019 An URL label is a TLabel on a form which displays some blue, underlined text which, when clicked with the mouse, opens a web page. This kind of labels is nothing new in Delphi, I remember using them even back in the 1990s, but they always were a pain in the lower back to create: Write the URL into the caption. Set the font color to blue Set the font to underlined Set the cursor to crHandPoint Write an OnClick event handler that opens the desired URL Lots of boring and repetitive work and on top of that a Windows API call which I kept forgetting. This led me to simply not use them. [...] https://blog.dummzeuch.de/2019/04/19/a-simple-way-to-create-an-url-label-in-delphi/ Share this post Link to post
Uwe Raabe 2063 Posted April 19, 2019 17 minutes ago, dummzeuch said: but they always were a pain in the lower back to create Not really since TLinkLabel was introduced as a standard VCL control in Delphi XE2. 2 Share this post Link to post
dummzeuch 1515 Posted April 19, 2019 4 minutes ago, Uwe Raabe said: TLinkLabel was introduced as a standard VCL control in Delphi XE2 Goes to show that I spend a lot of time working with old Delphi versions. 1 Share this post Link to post
dummzeuch 1515 Posted April 19, 2019 Hm, a TLinkLabel seems to have no FocusControl property and I could find no way to actually set an URL that is different from the caption. (OK, it's in the documentation: It allows HTML code.) But apparently it still does not automatically open the browser but calls the OnLinkClick event, so it solves a completely different problem than my code does. Share this post Link to post
Uwe Raabe 2063 Posted April 19, 2019 TLinkLabel is a wrapper around the Windows SysLink control. It has greater flexibility (f.i. can show a mixture of text and several links, not only one URL, as well as distinguish between a link, a focused link and a visited link) and thus requires a more sophisticated event handling (not every link needs to be opened in a browser). Anyway, my quote was rather related to the list of PITAs than your actual code. Share this post Link to post