Log in

View Full Version : Scrolling through strings in a stringgrid


Peter Kiers
07-03-2005, 12:56
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

Sachiel7
07-03-2005, 13:22
I assume that this post is Non-FIRST related.

Team 1111 is located in Edgewater MD, USA, not in the Netherlands.

This Forum is for FIRST Robotics Related discussion.

More about the competition can be found here:
http://www.usfirst.org/robotics/

As for help with your dilemma, I can offer none.

Ryan M.
07-03-2005, 13:26
Well, kinda a duplicate post (because of the above), but...

http://www.chiefdelphi.com/forums/showthread.php?t=29944

(I think that's Delphi, anyway... don't know the language... :))

Peter Kiers
07-03-2005, 13:28
Maybe i made a mistake
Correct me if i'm wrong:

I thought this was a Delphi-forum:

and i could ask a question when i have a problem with my program!

Greetings,

Peter Kiers