whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

22 Visitors Online


 
...show the text of a cell from a stringgrid as hint?
Autor: Schatzl Reinhard
[ Print tip ]  

Tip Rating (11):  
     


//im StringGrid den Zelleninhalt als Hint anzeigen
//Variablen für letzte Zellen Position im Grid
var
  
LastRow, LastCol : Integer;

//Cell Hint anzeigen
procedure TForm1.ShowCellHint(X,Y:Integer);
var
  
ACol, ARow : Integer;
begin
  
//ShowHint auf True setzen
  
If StringGrid.ShowHint = False Then
     
StringGrid.ShowHint := True;
  //Col und Row Position lesen
  
StringGrid.MouseToCell(X, Y, ACol, ARow);
  //wenn im gültigen Bereich zeige Zelleninhalt als Hint
  
If (ACol <> -1) And (ARow <> -1) Then
      
StringGrid.Hint:=StringGrid.Cells[ACol,ARow];
  If (ACol<>LastCol) or (ARow<>LastRow) Then
  begin
    
Application.CancelHint;
    LastCol:=ACol;
    LastRow:=ARow;
  end;
end;

//Example, im MouseMove Ereignis aufrufen
procedure TForm1.StringGridMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  
ShowCellHint(X,Y);
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners