StringGrid ma właściwość Hint, ale mogę przypisac hinta jednego na cały komponent.
Chciałbym uzyskać efekt, żeby każda komórka miała swojego osobistego hinta.
Podszedłem do tematu w ten sposób:
procedure TFormTypy.WeWyMouseMove( Sender: TObject; Shift: TShiftState;
X, Y: Integer );
begin
ObDane.MakeHintForCell( Sender, X, Y );
end;
procedure TDaneTypy.MakeHintForCell( const _Sender : TObject;
const _x : integer;
const _y : integer );
{$J+}
const
lastC : integer = 0;
lastR : integer = 1;
lastS : TObject = nil;
{$J-}
var
sgs : TStringGridSort;
row : integer;
col : integer;
hint : AnsiString;
pn : Tpoint;
begin
if _Sender is TStringGridsort then
sgs := TStringGridsort( _Sender )
else
Exit;
sgs.MouseToCell( _x, _y, col, row );
if ( lastC = col ) and ( lastR = row ) and ( LastS = _Sender ) then
begin
lastC := col;
lastR := row;
lastS := _Sender;
Exit;
end;
{ przygotuj hinta }
// Application.CancelHint;
sgs.hint := format( '%dx%d', [ col, row ] );
// pn.X := _x;
// pn.Y := _y;
// Application.HintPause := 1000;
// Application.HintHidePause := 1000;
// Application.ActivateHint( pn );
end;
Problem w tym, że hint odświeża się tylko gdy wyjedziemy kursorem za komponent i wjedzimey z powrotem, dlatego doklepałem:
procedure TFormMain.ApplicationShowHint( var HintStr: string; var CanShow: Boolean;
var HintInfo: THintInfo );
begin
HintInfo.ReshowTimeout := 1000;
end;
ale efekt nadal nie jest zadowalający ponieważ hinty wyświetlają się teraz non stop. Za pierwszym razem faktycznie czeka 1 sekundę, ale jak tylko zmienię komórkę StringGrida to hint wyskakuja natychmiastowo. Jak uzyskać, efekt, żeby odswieżony hint zachowywał się "normalnie"?