Bueno asi esta el relajo... Digo el codigo para direccionar el StringGrid:
El codigo:
Código Delphi
[-]
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Label1: TLabel;
Run: TButton;
UpAddr: TButton;
DownAddr: TButton;
Timer1: TTimer;
Button2: TButton;
Button3: TButton;
Memo1: TMemo;
Edit1: TEdit;
ValorCasilla: TLabel;
Label2: TLabel;
procedure InicializaGridBuffer;
procedure FormCreate(Sender: TObject);
procedure RunClick(Sender: TObject);
procedure UpAddrClick(Sender: TObject);
procedure DownAddrClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.InicializaGridBuffer;
var
i,j: integer;
begin
StringGrid1.ColWidths[0] := 35;
StringGrid1.Cells[0,0] := 'Addr';
j := $0000;
for i := 0 to 15 do
if i = 0 then
begin
StringGrid1.Cells[i+1,0] := IntTohex(i,2);
StringGrid1.Cells[0,i+1] := IntToHex(i,4);
end
else
begin
j := j + 16;
StringGrid1.Cells[i+1,0] := IntTohex(i,2);
StringGrid1.Cells[0,i+1] := IntToHex(j,4);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
InicializaGridBuffer;
end;
procedure TForm1.RunClick(Sender: TObject);
var
aCol, aRow : Integer;
x,y : Integer;
Cad : String;
begin
Cad := Label1.Caption;
aRow := StrToInt('$'+Cad[3])+1;
aCol := StrToInt('$'+Cad[4])+1;
StringGrid1.Col := aCol;
StringGrid1.Row := aRow;
x := aRow;
y := aCol;
ValorCasilla.Caption:= StringGrid1.Cells[y,x];
end;
procedure TForm1.UpAddrClick(Sender: TObject);
begin
Label1.Caption := inttohex(strtoint('$'+Label1.Caption)+1,4);
end;
procedure TForm1.DownAddrClick(Sender: TObject);
begin
Label1.Caption := inttohex(strtoint('$'+Label1.Caption)-1,4);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage(StringGrid1.Cells[6, 6]);
end;
procedure TForm1.Button3Click(Sender: TObject);
var
i,j: integer;
hexa: string;
begin
hexa := Edit1.text;
for i := 1 to 15 do begin
for j := 1 to 15 do begin
if Pos(' ',hexa) = 0 then
begin
StringGrid1.Cells[j,i] := hexa;
Exit;
end
else begin
StringGrid1.Cells[j,i] := Copy(hexa,1,2);
Delete(hexa,1,Pos(' ',hexa));
end;
end;
end;
end;
end.
Algunas cositas agregadas para ademas de mover el cursor dentro del grid que me retorne el valor en esa casilla en particular.Ademas de un Timer, para poder jugar con el tiempo.(en esta etapa no es tan importante, pero cuando esto tome forma y autonomia.Sera de mucho valor.)
Un Saludo.
PD:Se aceptan criticas y sugerencias.La otra parte del proyecto la continuare en otro hilo.Para no salirme del tema de este.(no desvirtual)
Gracias Caro.