drama22
asked on
how to manage invalidate between two tvirtualstringtree in same form?
i have two tvirtualstringtree in a form i wanted to invalidate them using timers
but i stuck with problems it seems that only 1 VST got invalidated and the other one ignored any idear why ?
i use invalidate with current code within timer
issue happens when i use beforecellpaint on each VSt
To be mor spicific issue happen when i try to draw blink text with
is my timer for blink text has issue ?
but i stuck with problems it seems that only 1 VST got invalidated and the other one ignored any idear why ?
i use invalidate with current code within timer
procedure Tform1.Timerval1Timer(Sender: TObject);
{$J+}
Const
iCount: Cardinal = 0;
{$J-}
begin
Inc(iCount);
if (iCount * TTimer(Sender).Interval) > 500 then
begin
xbool := NOT xbool;
iCount := 0;
end;
VDT1.Invalidate;
end;
procedure Tform1.Timerval2Timer(Sender: TObject);
{$J+}
Const
iCount: Cardinal = 0;
{$J-}
begin
Inc(iCount);
if (iCount * TTimer(Sender).Interval) > 500 then
begin
xbool := NOT xbool;
iCount := 0;
end;
VDT2.Invalidate;
end;
issue happens when i use beforecellpaint on each VSt
procedure Tform1.VDT1BeforeCellPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
var
Data: PUserdataon;
NewRect: TRect;
xOff, yOff: Integer;
begin
GradientFillCanvas(TargetCanvas, clred, clWhite, CellRect, gdHorizontal); // GraphUtil
if not Assigned(Node) then
begin
exit;
end;
Data := vdt1.GetNodeData(Node);
begin
NewRect := CellRect;
NewRect.Left := NewRect.Left + 2;
NewRect.Width := 24;
NewRect.Top := NewRect.Top;
NewRect.Bottom := NewRect.Bottom;
xOff := CellRect.Left + 70;
yOff := CellRect.Top +((30 - TargetCanvas.TextHeight('H')) div 2);
if xbool or (Data.FObject.bool= false) then
TargetCanvas.font.color := clred
else
TargetCanvas.font.color := clgray;
TargetCanvas.TextOut(xOff, yOff, Data.FObject.Username);
end;
end;
//vdt2 paint
procedure Tform1.VDt2BeforeCellPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
var
Data: PUserdataoff;
NewRect: TRect;
xOff, yOff: Integer;
begin
GradientFillCanvas(TargetCanvas, clred, clWhite, CellRect, gdHorizontal); // GraphUtil
if not Assigned(Node) then
begin
exit;
end;
Data := vdt2.GetNodeData(Node);
begin
NewRect := CellRect;
NewRect.Left := NewRect.Left + 2;
NewRect.Width := 24;
NewRect.Top := NewRect.Top;
NewRect.Bottom := NewRect.Bottom;
xOff := CellRect.Left + 70;
yOff := CellRect.Top +((30 - TargetCanvas.TextHeight('H')) div 2);
if xbool or (Data.FObject.bool= false) then
TargetCanvas.font.color := clred
else
TargetCanvas.font.color := clgray;
TargetCanvas.TextOut(xOff, yOff, Data.FObject.Username);
end;
end;
To be mor spicific issue happen when i try to draw blink text with
if xbool or (Data.FObject.bool= false) then
is my timer for blink text has issue ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.