Autor Beitrag
SnAkE2004
Hält's aus hier
Beiträge: 5

Win98,Win2000,WinXp,Linux,Dos

BeitragVerfasst: Do 02.12.04 13:35 
hi leute,
ich habe da mal eine frage wie kann ich in einen label einen internet Link (www.diedomain.de) programmieren ??


MFG
Snake2004
Crowbar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 180

WinXP, SP2
D6 Enterprise
BeitragVerfasst: Do 02.12.04 13:50 
Hi,
ich habe es hiermit "gelöst":
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
...
uses {...,}shellapi;
...
Procedure TMainForm.URLLabelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  URLLabel.Font.Color:=clred;
  URLLabel.Font.Style:=[fsUnderline];
end;

Procedure TMainForm.URLLabelClick(Sender: TObject);
Var
 url    : String;
 urladr : Array[0..79of Char;

begin
  url:='http://'+URLLabel.Caption;
  StrPCopy(urladr,url);
  ShellExecute(0,nil,urladr,nil,nil,SW_SHOWNORMAL);
end;
...

Es wird die OnMouseMove und die OnClick Methode der Labelkomponente verwendet.

Natürlich gibt es auch schon vorgefertigte Komponenten, wie z.B. die Jedi-Komponente (homepages.borland.com/jedi/jvcl).
Cu
Crowbar


Zuletzt bearbeitet von Crowbar am Do 02.12.04 17:45, insgesamt 1-mal bearbeitet
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Do 02.12.04 14:15 
Zusätzlich kannst du den Cursor über dem Label noch auf crHandPoint setzen.

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
SnAkE2004 Threadstarter
Hält's aus hier
Beiträge: 5

Win98,Win2000,WinXp,Linux,Dos

BeitragVerfasst: Do 02.12.04 15:58 
@ Crowbar irgend wie bekomme ich das nicht ihn (ich bin in sachen Delphi noch ein voller noob )

kann du das auch für dumme leute (wie mich) erklären ??


MFG
Snake2004
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Do 02.12.04 16:00 
vielleicht hilft das weiter :
www.delphi-forum.de/....php?p=144291#144291
Crowbar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 180

WinXP, SP2
D6 Enterprise
BeitragVerfasst: Do 02.12.04 17:55 
Hi,
als erstes fügst Du in Deinen Uses-Abschnitt "shellapi" hinzu.
Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ShellAPI;
...

Danach klickst Du das Label (Dein "Internet-Link") an und wechselst zum Objektinspektor. Im Objektinspektor wählst Du dann den Tab "Ereignisse" aus. Dort klickst Du auf "OnClick" und fügst den obigen Code ein (siehe "Procedure TMainForm.URLLabelClick(Sender: TObject);"). Das gleiche machst Du dann mit "OnMouseMove" (siehe "Procedure TMainForm.URLLabelMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);").

So, das war es eigentlich schon!

Cu Crowbar
P.S. Mein Label habe ich als "URLLabel" bezeichnet (Standard wäre z.B. "label1").
mick
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 159



BeitragVerfasst: Mo 20.12.04 21:47 
wie kann ich das
URLLabel.Font.Style:=[fsUnderline];

wieder rueckgaengig machen? muss den wert doch irgendwie false setzten - nur wie?

ciao,
mijozi.
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mo 20.12.04 21:53 
ausblenden Delphi-Quelltext
1:
URLLabel.Font.Style:=[];					

_________________
JSXGraph
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mo 20.12.04 21:54 
Hi!

so:

ausblenden Delphi-Quelltext
1:
urllabel.font.style := []					


Moderiert von user profile iconKarlson: Verdammt
mick
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 159



BeitragVerfasst: Mo 20.12.04 23:25 
ui, da war wohl einer ein klein wenig schneller als der andere... ;-)

hm, das funzt? muss ich mal testen. denn was mich wundert: unter Font.Style gibt es mehrere weitere eintraege, nicht nur fsUnderline, sondern auch fsbold, fsitalic usw.
was, wenn mehrere dieser werte auf true stehen, ich aber nur einen wieder auf false haben moechte?

ciao,
mijozi.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Mo 20.12.04 23:32 
Hinweis am Rande: in Fontstyle is nix true oder false; aber wenn dus so siehst, dass true bedeutet, dass ein Attribut in der Menge Font.Stlye enthalten ist, stimmts natürlich ;)

Du kannst also zB

ausblenden Delphi-Quelltext
1:
X.Font.Style := [fsBold, fsItalic];					


Dann wären bold und italic true, und underline strikeout false ;)

AXMD
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Di 21.12.04 00:52 
Da muss ich jetzt spontan sagen, dass das im OI etwas verwirrend ist. Spontan dachte ich aufgrund der Verknüpfungen im Oi das dass doch auch mit font.style.fsunderline := false gehen müsste. Habs dann glücklicherweise nochmal ausprobiert. Aber AXMD war ja eh schneller ;)
mick
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 159



BeitragVerfasst: Di 21.12.04 09:01 
jetzt hab ich's geschnaggelt - die firma dankt!

ciao,
mijozi.