Ver Mensaje Individual
  #27  
Antiguo 25-10-2018
TavoBran TavoBran is offline
Miembro
NULL
 
Registrado: oct 2018
Posts: 13
Reputación: 0
TavoBran Va por buen camino
juniorSoft amigo usted es todo un crack me ayudo muchisimo el dia de hoy espero que estos conocimientos que tiene le ayuden mucho y gracias hoy aprendi mucho ha el error al anterior mensaje era que estabarepitiendo la i despues de crear los edits:

Código Delphi [-]
Edits[i,i] := TEdit.Create(Self);
      Edits[i,i].Text := '';
      Edits[i,i].Top := 21 * (i + 1);
      Edits[i,i].Left := 21 * (j + 1);
      Edits[i,i].Width := 20;
      Edits[i,i].Height := 20;
      Edits[i,i].AutoSize := False;
      Edits[i,i].Enabled := False;
      Edits[i,j].Parent := Panel1;

en estos campos jaja fue muy chistoso ese error pero gracias por todo dejo la solucion.

Código Delphi [-]
unit Ejecucion;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Menus;

type
  TMatriz = array of array of TEdit;
  TfrmEjecucion = class(TForm)
    Button1: TButton;
    Edt: TEdit;
    Panel1: TPanel;
    Panel2: TPanel;
    Button2: TButton;
    Button3: TButton;
    MainMenu1: TMainMenu;
    Volver1: TMenuItem;
    Button4: TButton;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);

  private
    { Private declarations }
  public
    procedure CrearEdits(Edits:TMatriz; Mx, My:integer);
    procedure LlenarEdits(Edits:TMatriz; Mx, My:integer);
  end;

var
  frmEjecucion: TfrmEjecucion;


implementation

{$R *.dfm}

procedure TfrmEjecucion.Button1Click(Sender: TObject);
var
  Matriz : TMatriz;
  Mx,My : Integer;
begin
  if Trim(Edt.Text) = '' then
  begin
    ShowMessage('Debe escribir un número');
    Exit;
  end;
  //Grivera Desicion para que no sea tan grande la matriz
  if StrToInt(Edt.Text) >= 11 then
  begin
    ShowMessage('El valor tiene que ser igual o menor a 10');
    Edt.Clear;
  end
  else
  begin
    //Grivera Establece el valor de la matriz
    Mx := StrToInt(Edt.Text);
    My := StrToInt(Edt.Text);
    SetLength(Matriz, Mx, My);
    Button1.Visible := False;
    Edt.Visible := False;

    CrearEdits(Matriz,Mx,My);
    llenarEdits(Matriz,Mx,My);
  end;
end;

procedure TfrmEjecucion.CrearEdits(Edits: TMatriz; Mx, My: integer);
var
   i,j : integer;
begin
  for i := 0 to Mx-1 do
  begin
    for j := 0 to My-1 do
    begin
      Edits[i,j] := TEdit.Create(Self);
      Edits[i,j].Text := '';
      Edits[i,j].Top := 21 * (i + 1);
      Edits[i,j].Left := 21 * (j + 1);
      Edits[i,j].Width := 20;
      Edits[i,j].Height := 20;
      Edits[i,j].AutoSize := False;
      Edits[i,j].Enabled := False;
      Edits[i,j].Parent := Panel1;
      Button3.Visible := True;
    end;
  end;
end;

procedure TfrmEjecucion.LlenarEdits(Edits: TMatriz; Mx, My: integer);
var
  i,j:integer;
begin
  for i := 0 to Mx-1 do
  begin;
    for j := 0 to My-1 do
    begin
      Edits[i,j].Text:=IntToStr(Random(100));
    end;
  end;
end;

end.
Responder Con Cita