Thread View: borland.public.cppbuilder.internet.web
10 messages
10 total messages
Started by saik
Fri, 18 Aug 2006 20:53
link to url
Author: saik
Date: Fri, 18 Aug 2006 20:53
Date: Fri, 18 Aug 2006 20:53
5 lines
1007 bytes
1007 bytes
Hello all. I have a lable www.user.com. I want to show the web page when click on the lable. How can i do this. Thanks for you suggestions
Re: link to url
Author: Michel Leunen
Date: Sat, 19 Aug 2006 08:56
Date: Sat, 19 Aug 2006 08:56
18 lines
1338 bytes
1338 bytes
saik wrote: > I have a lable www.user.com. > I want to show the web page when click on the lable. > How can i do this. Put this in the OnMouseUp event of your Label: ShellExecute(NULL,"open",Label1->Caption,NULL,NULL,SW_SHOW); Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: link to url
Author: Michel Leunen
Date: Sat, 19 Aug 2006 09:05
Date: Sat, 19 Aug 2006 09:05
36 lines
2065 bytes
2065 bytes
Michel Leunen wrote:
> ShellExecute(NULL,"open",Label1->Caption,NULL,NULL,SW_SHOW);
Should be
ShellExecute(NULL,"open",Label1->Caption.c_str(),NULL,NULL,SW_SHOW);
You can also put the font color of your label to blue and change the
cursor to a hand cursor when the mouse is over the label. Like this:
void __fastcall TForm1::Label1MouseEnter(TObject *Sender)
{
Screen->Cursor = crHandPoint;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Label1MouseLeave(TObject *Sender)
{
Screen->Cursor = crDefault;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Label1MouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
ShellExecute(NULL,"open",Label3->Caption.c_str(),NULL,NULL,SW_SHOW);
}
Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Re: link to url
Author: Remy Lebeau (TeamB)
Date: Sat, 19 Aug 2006 19:16
Date: Sat, 19 Aug 2006 19:16
28 lines
1936 bytes
1936 bytes
"Michel Leunen" <nospam@noreply.please> wrote in message news:44e6d444@newsgroups.borland.com... > Should be > ShellExecute(NULL,"open",Label1->Caption.c_str(),NULL,NULL,SW_SHOW); To help ShelExecute() know exactly what to execute, you should include the "http://" portion in the URL as well. > You can also put the font color of your label to blue and change the > cursor to a hand cursor when the mouse is over the label. Like this: You don't need to use events for that. Simply set the Cursor property at design-time, and the mouse will automatically change at runtime every time it is over the Label. What you could do with the events, however is change the font color of the Label to another color, such as red, to provide a hover effect. > void __fastcall TForm1::Label1MouseUp(TObject *Sender, TMouseButton > Button, > TShiftState Shift, int X, int Y) Use the OnClick event instead. Gambit
Re: link to url
Author: Michel Leunen
Date: Sat, 19 Aug 2006 20:19
Date: Sat, 19 Aug 2006 20:19
27 lines
1945 bytes
1945 bytes
Remy Lebeau (TeamB) wrote: > You don't need to use events for that. Simply set the Cursor property at > design-time, and the mouse will automatically change at runtime every time > it is over the Label. You're right. It's much easier. I forgot about that property. >> void __fastcall TForm1::Label1MouseUp(TObject *Sender, TMouseButton >> Button, >> TShiftState Shift, int X, int Y) > > Use the OnClick event instead. Why? Since a TLabel is not a windowed control, it can't have focus. Therefore, the only way to trigger the OnClick event is using the mouse. In this case, IMO, using the OnMouseUp event is equally good, isn't it? Or am I missing something? Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: link to url
Author: Remy Lebeau (TeamB)
Date: Sat, 19 Aug 2006 21:09
Date: Sat, 19 Aug 2006 21:09
19 lines
1724 bytes
1724 bytes
"Michel Leunen" <nospam@noreply.please> wrote in message news:44e7722b$1@newsgroups.borland.com... > Why? Since a TLabel is not a windowed control, it can't have focus. Non-windowed controls can still be clicked on. Case in point - your approach is using mouse events, even though TLabel does not receive focus. TLabel can handle mouse events, and thus can also handle clicks. It does has a published OnClick event, and it works fine. All controls have that event, even though they don't all publish it. > IMO, using the OnMouseUp event is equally good, isn't it? A click requires a mouse up, but a mouse up does not always mean a click occured. Gambit
Re: link to url
Author: Larry
Date: Mon, 04 Sep 2006 05:12
Date: Mon, 04 Sep 2006 05:12
30 lines
2315 bytes
2315 bytes
On Sat, 19 Aug 2006 14:09:14 -0700, "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote: > >"Michel Leunen" <nospam@noreply.please> wrote in message >news:44e7722b$1@newsgroups.borland.com... > >> Why? Since a TLabel is not a windowed control, it can't have focus. > >Non-windowed controls can still be clicked on. Case in point - your >approach is using mouse events, even though TLabel does not receive focus. >TLabel can handle mouse events, and thus can also handle clicks. It does >has a published OnClick event, and it works fine. All controls have that >event, even though they don't all publish it. > >> IMO, using the OnMouseUp event is equally good, isn't it? > >A click requires a mouse up, but a mouse up does not always mean a click >occured. > What if they TAB through the form, and then hit the enter button when they get to the browser link? I always uses a speedbutton. It gives that 'activated' look anyway when the mouse is over it and it has Flat set to true. I wish there was a 'hyperlink' control that had all these features (the cursor and font color) already setup. It can be a little tedious coding -- or repetive actually. Something eith a URL property.
Re: link to url
Author: Michel Leunen
Date: Mon, 04 Sep 2006 18:04
Date: Mon, 04 Sep 2006 18:04
16 lines
1646 bytes
1646 bytes
Larry wrote: > What if they TAB through the form, and then hit the enter button when > they get to the browser link? You can't. A label is not a windowed control and can't have focus. That means that you can't TAB to it. Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: link to url
Author: Remy Lebeau (TeamB)
Date: Mon, 04 Sep 2006 19:20
Date: Mon, 04 Sep 2006 19:20
23 lines
2103 bytes
2103 bytes
"Larry" <nospam@nospam.net> wrote in message news:9ucnf25art5kgjgs0gsv8mfhotgohtij01@4ax.com... > What if they TAB through the form, and then hit the enter button > when they get to the browser link? They won't be able to do that. Like Michel said earlier, TLabel is not a windowed control. It cannot receive focus, and thus cannot respond to tabbing. If you need that, then use a TStaticText instead of a TLabel. > I wish there was a 'hyperlink' control that had all these features > (the cursor and font color) already setup. TLabel works just fine as a hyperlink control. Set the Font Color to clBlue, and the Cursor property to crHandPoint. Use the OnClick event to launch the URL. You can also use the OnMouseOver/Leave events (BDS 2006 only) or intercept the CM_MOUSEENTER/LEAVE messages directly (pre-BDS) to implement roll-over effects, such as changing the Font Color to another color. Gambit
Re: link to url
Author: Larry
Date: Mon, 04 Sep 2006 22:57
Date: Mon, 04 Sep 2006 22:57
11 lines
1278 bytes
1278 bytes
On Mon, 04 Sep 2006 20:04:08 +0200, Michel Leunen <nospam@noreply.please> wrote: > >You can't. A label is not a windowed control and can't have focus. That >means that you can't TAB to it. > >Michel TSpeedButton
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads