?
Solved

Hyperlinks on Forms AND Right Alignment of Text

Posted on 2003-03-29
10
Medium Priority
?
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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.

 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

762 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