Autor Beitrag
Saladin
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 12.08.02 00:09 
Wie mach ich das??


MfG
Saladin
Deykin11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 12.08.02 00:47 
Willst Du wissen man einen Hint so wie man ihn in Windows sieht in Deinem Programm anzeigen, wenn man mit der Maus über einen Knopf oder Edit Feld fährt?

Im Objektinspektor die Eigenschaft ShowHint der jeweiligen Komponente auf true setzten und in der Eigenschaft Hint dann den anzuzeigenden Text eingeben.
Saladin Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 12.08.02 11:03 
Titel: Das ist mir klar
Nein das ist mir klar.
Ich möchte aber gesteuert das Hint anzeigen. d.h. Wenn ich auf Button1 drücke, soll das Hint von Button2 erscheinen, ohne das Ich mit der Maus auf das Controll muss!!

Klar.....?




MfG
Saladin
Saladin Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 12.08.02 11:08 
Titel: Ach so....
Ach so...

Gibt es eine Möglichkeit die Position des Hints zu bestimmen und oder zu setzen??


MfG
Saladin
Saladin Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Di 13.08.02 13:45 
Habs gefunden!!
ao
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 145

Win XP Prof.
D7 Ent.
BeitragVerfasst: Di 13.08.02 13:49 
Sagst du uns auch wo bzw. wie? Sonst, denke ich, ist dieser Thread für andere unbrauchbar! :wink:

Gruß
Andreas
Saladin Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Di 13.08.02 17:04 
Ja sicher.
Hab ich von Delphi3000.com

Zitat:
You might sometimes want to force a hint window to appear. For example, when the mouse enters a certain cell or column of a grid. Answer:

Thanks to Jonas Juskys

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
var hintWnd: THintWindow; 

procedure TForm1.ActivateHintNOW( x,y: Integer); 
var rect: TRect; 
begin 
HintTxt := 'qq'; 
if hintTxt <> '' then 
begin 
rect := hintWnd.CalcHintRect( Screen.Width, hinttxt, nil); 
rect.Left := rect.Left + x; 
rect.Right := rect.Right + x; 
rect.Top := rect.Top + y; 
rect.Bottom := rect.Bottom + y; 
hintWnd.ActivateHint( rect, hinttxt); 
end; 
end;

Note: To hide a hint window that is activated directly by calling ActivateHint,
use the ReleaseHandle method.


Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt, Quote-Tag hinzugefügt
JRegier
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: Sa 23.07.05 19:07 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
var hintWnd: THintWindow;

constructor Create(..)
begin

hintWnd := THintWindow.Create(Self); // muß ich hier mit Create erzeugen?
hintWnd.Parent := ListBox;
end; 

procedure TForm1.ActivateHintNOW(hinttxt : String; x,y: Integer); // habe ich hier geändert  
var rect: TRect; 
begin 
HintTxt := 'qq'; 
if hintTxt <> '' then 
begin 
rect := hintWnd.CalcHintRect( Screen.Width, hinttxt, nil); 
rect.Left := rect.Left + x; 
rect.Right := rect.Right + x; 
rect.Top := rect.Top + y; 
rect.Bottom := rect.Bottom + y; 
hintWnd.ActivateHint( rect, hinttxt); 
end; 
end;


Hallo ich habe den Code hier benutzt und beim Bewegen über eine ListBox Hints anzeigen lassen aber seitdem läßt sich mit Programm nichts machen
er zeigt überall Hints an! Habe auch mit HintWnd.Hide versucht, ich dachte dass das Programm deshalb nicht reagiert! Was kann ich tun?

Außerdem bekomm ich mit der Position der Hints nicht richtig hin! Muß ich die Koordinaten OnScreen abfragen? Ich kenn die function in Java
aber nicht in Delphi! Wie heißt die in Delphi?

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: So 24.07.05 06:23 
user profile iconJRegier hat folgendes geschrieben:
Hallo ich habe den Code hier benutzt und beim Bewegen über eine ListBox Hints anzeigen lassen aber seitdem läßt sich mit Programm nichts machen
er zeigt überall Hints an! Habe auch mit HintWnd.Hide versucht, ich dachte dass das Programm deshalb nicht reagiert! Was kann ich tun?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type
  TForm1 = class(TForm)
  {...}
  private
    { Private-Deklarationen }
    HintWindow: THintWindow;
  {...}
  end;

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
{--------------------------------------------------------------------------------------------------}

procedure TForm1.FormCreate(Sender: TObject);
begin

  HintWindow := THintWindow.Create(nil);

end;

{--------------------------------------------------------------------------------------------------}

procedure TForm1.FormDestroy(Sender: TObject);
begin

  HintWindow.Free;

end;

{--------------------------------------------------------------------------------------------------}

procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  ARect: TRect;
  AHint: String;
begin

  AHint := 'Mein Text';

  with TListBox(Sender), Mouse do
    if Capture = Handle then
    begin
      if (X < 0) or (X > Width) or (Y < 0) or (Y > Height) then
      begin
        Capture := 0;
        HintWindow.ReleaseHandle;
      end else
      begin
        ARect := HintWindow.CalcHintRect(HintWindow.Canvas.TextWidth(AHint), AHint, nil);
        with ARect do
        begin
          Left := CursorPos.X + 20;
          Top := CursorPos.Y - 20;
          Right := Right + Left;
          Bottom := Bottom + Top;
        end;
        HintWindow.ActivateHint(ARect, AHint);
      end;
    end else
    begin
      Capture := Handle;
    end;

end;

{--------------------------------------------------------------------------------------------------}

_________________
Ciao, Sprint.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 24.07.05 09:36 
{Hint bei Listbox anzeigen, ShowHint auf True !}

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  I : Integer;
begin
  I := ListBox1.ItemAtPos(Point(x,y), True);
  IF I = -1 then
    begin
      ListBox1.Hint := '';
      Application.CancelHint;
      Exit;
    end;
    IF (ListBox1.Hint <> ListBox1.Items[I]) then
    begin
      Application.CancelHint;
      ListBox1.Hint := ListBox1.Items[I];
      Application.HintPause := 50; //Dauer bis Hint angezeigt wird
     
    end;
end;
JRegier
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1268

Win XP Home, Prof, 2003 Server
D6 Enterprise
BeitragVerfasst: So 24.07.05 09:49 
user profile iconBlackheart666 hat folgendes geschrieben:
{Hint bei Listbox anzeigen, ShowHint auf True !}

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  I : Integer;
begin
  I := ListBox1.ItemAtPos(Point(x,y), True);
  IF I = -1 then
    begin
      ListBox1.Hint := '';
      Application.CancelHint;
      Exit;
    end;
    IF (ListBox1.Hint <> ListBox1.Items[I]) then
    begin
      Application.CancelHint;
      ListBox1.Hint := ListBox1.Items[I];
      Application.HintPause := 50; //Dauer bis Hint angezeigt wird
     
    end;
end;


Hey super! Vielen Dank, klappt wunderbar!