View Single Post
  #1   Spotlight this post!  
Unread 07-03-2005, 12:56
Peter Kiers Peter Kiers is offline
Registered User
#1111
 
Join Date: Mar 2005
Location: The Netherlands
Posts: 2
Peter Kiers is an unknown quantity at this point
Scrolling through strings in a stringgrid

Hi i am Peter,

I have a litte problem:

I am working on a program that pings servers, so i use
a stringgrid with 30 servernames. The program scrolls
through the stringgrid to check the servers.

Only the program checks empty cells too!

How can i tell my program to only check the cells
that are filled with text.

I thing the change must be made in the following procedure:

procedure TForm1.GridServersDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
Kleur: TColor;
begin
with (Sender as TStringGrid) do
begin
if gdFixed in State then Kleur := FixedColor
else if IsWaiting then Kleur := Color
else if gdFocused in State then Kleur := clYellow
else if gdSelected in State then Kleur := clLime
else Kleur := Color;
with Canvas do
begin
Brush.Color := Kleur;
Font.Color := clBlack;
FillRect(Rect);
if not IsWaiting and (gdFocused in State) then
begin
Draw(Rect.Left, Rect.Top, Image1.Picture.Graphic);
Rect.Left := Rect.Left + Image1.Width +2;
end;
TextOut(Rect.Right - TextWidth(Cells[ACol, ARow]) - 2,
Rect.Top + 2, Cells[ACol, ARow]);

end;
end;
end;


Greetings,

Peter Kiers