Question

i would like to create a procedure on this.

procedure TForm1.Button1Click(Sender: TObject);
var
  a: Array[0..1, 0..2] of TControl; // need to be pass
  tmp: Array[0..1] of TControl;
  i, j, iCnt : Integer;
begin
//-------------------------------------
  a[0][0] := Panel1; //sample data inside the main panel
  a[0][1] := Panel2; 
  a[0][2] := Panel3;
  a[1][0] := Panel4;
  a[1][1] := Panel5;
  a[1][2] := Panel6;
//-------------------------------------

  for i := low(a) to high(a) do
  AutoSizeCtrlWidth(mainpanel, a[i], 20, 20);
  for j := low(a[1]) to High(a[1]) do
  begin
    for i := low(a) to high(a) do
    tmp[i] := a[i][j];
    AutoSizeCtrlHeight(mainpanel, tmp, 20,20);
  end;
// 
end;

Example:

procedure AutoSizeCtrlWidthHeight(AParentCtrl: TControl; arControls: Array of TControl; ASpacing, AMargin: Integer);

how to create a procedure having a parameter of two or multi dimensional array?

Was it helpful?

Solution

type
  TMyDataType = array of array of integer;

procedure MyProcedure(const Data: TMyDataType);
begin
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top