0

What I want:

  1. Assign some TButtons controls to several cells.
  2. implement a Drag & Drop routine to move created buttons in the AdvStringGrid (v8.6).
  3. Previous steps with the AdvStringGrid BidiMode set to bdRightToLeft.

Used Code for testing purpose:

procedure TForm1.FormCreate(Sender: TObject);
var B:TButton;
begin
AdvStringGrid1.Bidimode:=bdRightToLeft;
b:=TButton.Create(nil);
b.Caption:='btn cell';
AdvStringGrid1.CellControls[2,2]:=b;
end;

Issues:

  1. Even with an empty Gird the code "AdvStringGrid1.ControlCount" return 20 hidden controls as shown in picture below

enter image description here

  1. the code "AdvStringGrid1.CellControls[col,row]" when bidimode is bdRightToLeft do not work unless the col index is 0 or 1 (changing bidimode the routine works fine)

  2. after assigning a drag and drop routine to each button at creation time using the bidLeftToRight of course after freeing the cell from witch the button is draged the AdvStringGrid1.ControlCount routine return an incremented value for each visited cell even using the officiel doc recomandation from tms

    var
    ctrl: TControl;

    ctrl := grid.CellControls[x,y];
    if Assigned(ctrl) then
    begin
    FreeAndNil(ctrl);
    grid.CellControls[x,y] := nil;
    end;

  3. all Cells that was filled with buttons and freed are shown blinking as ghost controls when the main form or the grid is manually resizing what ever the bidimode is.

How can i bypass this problem to fill the grid with as mutch controls as i want free theme after usage return the correct visible controlcount in the grid and resize the main form without show ghost controls in there previous cells positions?

Thanks in advance

Novicius
  • 31
  • 5

0 Answers0