Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: URL link on TForm


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Mar 22, 2016 10:57 AM Last Post By: Remy Lebeau (Te...
Dan Ambrose

Posts: 87
Registered: 12/11/03
URL link on TForm  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2016 11:11 AM
Greetings from Saint Louis, MO USA

I'm using C++ builder XE5 - I want to put a URL link on a form. So if the user clicks it will open up the default web browser. Is there a VCL object that will do this ?

Dan

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: URL link on TForm  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 21, 2016 9:33 AM   in response to: Dan Ambrose in response to: Dan Ambrose
Dan wrote:

I'm using C++ builder XE5 - I want to put a URL link on a form. So if
the user clicks it will open up the default web browser. Is there a
VCL object that will do this ?

You can use a standard TLabel for that. Set its Color as desired, enable
the fsUnderline flag in its its Font.Style property, and set its Cursor property
to crHandPoint. Then, in its OnClick event you can call the Win32 ShellExecute/Ex()
function to launch the desired URL. For example:

void __fastcall TForm1::Label1Click(TObject *Sender)
{
    ShellExecuteW(Handle, NULL, Label1->Caption.c_str(), NULL, NULL, SW_SHOWDEFAULT);
}


--
Remy Lebeau (TeamB)
Dan Ambrose

Posts: 87
Registered: 12/11/03
Re: URL link on TForm  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 22, 2016 7:18 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy,

I've got the URL working but I'm having trouble with the color. It ignores the TFont color property setting. It is stuck with app theme color. This is in a TForm About dialog box. I'm using a TLabel and I'm setting .. ParentColor = false; ParentFont = false

I'm doing this same color thing elsewhere in the program and its working. Its not a URL ..Just a color over ride from the style theme. The apps main form has a TLabel with color being forced to red. It works fine.
Its obvious I'm not doing something right in the about box TLabel. Not sure if this matters .... The about Tform has Autocreate is turned off. I'm calling new and executing modal.

Any suggestions ?

Dan

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: URL link on TForm  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 22, 2016 10:57 AM   in response to: Dan Ambrose in response to: Dan Ambrose
Dan wrote:

I've got the URL working but I'm having trouble with the color.
It ignores the TFont color property setting.

Works fine for me.

I'm doing this same color thing elsewhere in the program and its
working. Its not a URL ..Just a color over ride from the style theme.
The apps main form has a TLabel with color being forced to red. It
works fine. Its obvious I'm not doing something right in the about box
TLabel.

Did you compare their properties for any differences?

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02