Strange behavior of StringGrid in Delphi 5.0. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Strange behavior of StringGrid in Delphi 5.0.

Hi! I made GUI program which enable/disable the privilege of editing StringGrids. However, when I the first time run the rountine that enable user to edit the StringGrid, strange thing happen: the content in upper-left-corner cell of the first StringGrid disappeared. When click on that cell, the content appeared again. It will make the user not comfortable, but I don't know the reason.

Can you give me some idea about it?

Thank you!

When I click the button to enable the user to edit StringGrid, following code is related to StringGrid:

The SetStringGrid routine is compiled to another .DLL file:

procedure SetStringGrid(var G: TStringGrid; alive: Boolean; bs:TBorderStyle;
GridLineW: Integer; FontColor: TColor);
if alive=False then begin
G.EditorMode:= False
end; {if} //always disable at first
if alive=True then begin //always enable at last
G.EditorMode:= True;
end; {if}
end;{procedure SetStringGrid}


  • earth_walkerearth_walker Posts: 184Member
    Hi! I find out the exect line which makes the problem. However, still don't know how to solve it, but bypass it with a method which should not be a good idea.

    following is my code in that routine, the line which makes the problem is [code]LinearDivisionViewerForm.FormStyle:= fsStayOnTop;[/code]
    I guess it is because computer redraws the background color of the focused cell and cover the string in it.

    Thank you!

    procedure TLinearDivisionViewerForm.ModifyButtonClick(Sender: TObject);
    with LinearDivisionViewerForm do begin
    //Set up the buttons and Grids
    end; // with
    //this line will make display error
    LinearDivisionViewerForm.FormStyle:= fsStayOnTop;
    StringGrid_X.Cells[1,1]:= IntToStr(XDivision[0].NumDiv); //patch
    LinearDivisionViewerForm.Enabled:= True;
    end; {procedure}

Sign In or Register to comment.