| Autor |
Beitrag |
Saladin
Hält's aus hier
Beiträge: 14
|
Verfasst: Mo 12.08.02 00:09
Wie mach ich das??
MfG
Saladin
|
|
Deykin11
      
Beiträge: 22
|
Verfasst: 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 
Hält's aus hier
Beiträge: 14
|
Verfasst: 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 
Hält's aus hier
Beiträge: 14
|
Verfasst: 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 
Hält's aus hier
Beiträge: 14
|
Verfasst: Di 13.08.02 13:45
|
|
ao
      
Beiträge: 145
Win XP Prof.
D7 Ent.
|
Verfasst: Di 13.08.02 13:49
Sagst du uns auch wo bzw. wie? Sonst, denke ich, ist dieser Thread für andere unbrauchbar!
Gruß
Andreas
|
|
Saladin 
Hält's aus hier
Beiträge: 14
|
Verfasst: 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
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 Christian S.: Code- durch Delphi-Tags ersetzt, Quote-Tag hinzugefügt
|
|
JRegier
      
Beiträge: 1268
Win XP Home, Prof, 2003 Server
D6 Enterprise
|
Verfasst: Sa 23.07.05 19:07
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); hintWnd.Parent := ListBox; end;
procedure TForm1.ActivateHintNOW(hinttxt : String; 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; |
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 Christian S.: Code- durch Delphi-Tags ersetzt.
|
|
Sprint
      
Beiträge: 849
|
Verfasst: So 24.07.05 06:23
JRegier 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? |
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8:
| type TForm1 = class(TForm) private HintWindow: THintWindow; end; |
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
      
Beiträge: 2195
XP
D3Prof, D6Pers.
|
Verfasst: So 24.07.05 09:36
{Hint bei Listbox anzeigen, ShowHint auf True !}
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; end; end; |
|
|
JRegier
      
Beiträge: 1268
Win XP Home, Prof, 2003 Server
D6 Enterprise
|
Verfasst: So 24.07.05 09:49
|
|