Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Hyperlinks on Forms AND Right Alignment of Text

Posted on 2003-03-29
10
Medium Priority
?
267 Views
Last Modified: 2010-08-05
I have a couple of question here.  I don't think they are difficult ones for someone who knows what they are doing.


Question 1:
Can anyone please tell me if it is possible to have a hyper link on a form?  Say for example I have a label on a form that contains a URL e.g. www.google.com  Can the user click on it and it opens up IE or Netscape and goes to that URL?  If this is possible how is it done?

Question 2:
How do you set text to show up on the right hand side of an edit box?  By deafult it is on the left.


I look forward to your responses.
0
Comment
Question by:zork007
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 8233321
procedure TForm1.Label1Click(Sender: TObject);
Var TempString : array[0..79] of char;
begin
  StrPCopy(TempString,Label1.Caption);
  ShellExecute(0, Nil, TempString, Nil, Nil, SW_NORMAL);
end;

The Tedit I suppose is a Tedit? has a property called it alignment you can set it to right.


Best Regards.
Marcos.
0
 

Accepted Solution

by:
Spetson earned 60 total points
ID: 8233379
Just take a look on this Vcl:
http://www1.odn.ne.jp/~cjk59150/delphi/spp.zip

This Vcl have a "URL LABEL" type!
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 8233380
You can't right align text in a TEdit, except if it's a multi-line edit box.
Use a TLabel, do your own component or fill with spaces.


Remember to change your TLabel.Cursor to crHandPoint - just to make it nice.
If you want the text to change when the mouse is over the label, you must override CMMouseEnter/CMMouseLeave.

var
 s : string;
begin
try
s:='mailto:'+'address'; //if mail
s:='http://www.sadkfj.com'; //if home-page
if ShellExecute(Application.Handle,'open',PChar(s),nil,nil,SW_NORMAL) <= 32 then
 Showmessage('Error ....');
Good luck
Peter
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:nafeelm
ID: 8237385

Answer 1:

Set the Labe1l.Cursor property to crHandPoint at Design Time!

Write a Label1Click event as:

procedure TForm1.Label1Click(Sender: TObject);
begin
  ShellExecute(0, nil, PChar(Edit1.Text), nil, nil, SW_SHOWNORMAL);
end;


Answer 2:
Its not possible to Right Align a TEdit component!
You will have to create your own enhanced TEdit component!
0
 
LVL 1

Expert Comment

by:nafeelm
ID: 8237389

Answer 1:

Set the Label1.Cursor property to crHandPoint at Design Time!

Write a Label1Click event as:

procedure TForm1.Label1Click(Sender: TObject);
begin
  ShellExecute(0, nil, PChar(Label1.Caption), nil, nil, SW_SHOWNORMAL);
end;


Answer 2:
Its not possible to Right Align a TEdit component!
You will have to create your own enhanced TEdit component!
0
 

Author Comment

by:zork007
ID: 8237917
Can anyone please tell me how to do:

1. Change the mouse pointer when it hovers over a label?

2. How to create an enhanced TEdit component?

I can now access the web pages by clicking the link thanks.
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 8240694
Spetson has posted a comment about this issue. Take a look at the SSP.zip collection.
Search for CMMouseEnter/CMMouseLeave in SUIUTLLabel.pas, and you'll have the answer to your 1. question.

Regarding your 2. question i think its to much to ask for.
Try do your own component - its fun.
0
 
LVL 1

Expert Comment

by:nafeelm
ID: 8243812

Ans 1:
At design-time select Label1 and set this property
Label1.Cursor:=crHandPoint



Else if you want to set it at run-time then

In the MouseMove event of the Label1 set:
Label1.Cursor:=crHandPoint
and
In the MouseMove event of Form1 set:
Label1.Cursor:=crDefault




Ans 2:
Try searching for an enhanced TEdit component using the 'google.com' search engine with search keywords as 'Right Align TEdit'

0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 8243957
About your second question - take a look at the following question : http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20341702.html
0
 

Author Comment

by:zork007
ID: 8256510
Thanks for all your help.  I can now access a URL and change the mouse pointer.

I cheated and used static text to right align results.  My inputs are still left align though.  Oh well.

Thanks again.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question