Ver Mensaje Individual
  #5  
Antiguo 28-05-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

Bueno, más o menos le había buscado por el mismo lado , te pongo la prueba que hice por si te ayuda en algo.
Código Delphi [-]
...
type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure Memo1Exit(Sender: TObject);
  private
    procedure CMDialogKey(Var Msg: TWMKey);message CM_DIALOGKEY;
  public
  end;

var
  Form1: TForm1;

implementation 

var
  TabPressed: Boolean = False;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Memo1.Clear;
end;

procedure TForm1.CMDialogKey(var Msg: TWMKey);
begin
  if(ActiveControl is TMemo)and(Msg.Charcode = VK_TAB) then
    with StringGrid1 do
    begin
      Cells[Col,Row]:=  Memo1.Lines.Text;
      Col:= Col + 1;
      TabPressed:= True;
    end;
  inherited;
end;

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var
  Texto: string;
begin
  with TStringGrid(Sender) do
  begin
    Canvas.FillRect(Rect);
    Texto:= Cells[ACol,ARow];
    DrawText(Canvas.Handle, PChar(Texto), StrLen(PChar(Texto)),
    Rect, DT_WORDBREAK);
    if (gdSelected in State) and (ACol=1) then
    begin
      Memo1.Left := Rect.Left + Left + 2;
      Memo1.Top := Rect.Top + Top + 2;
      Memo1.Width := Rect.Right - Rect.Left;
      Memo1.Height := Rect.Bottom - Rect.Top;
      Memo1.Visible := True;
      Memo1.SetFocus;
    end
    else
      Memo1.Visible := False;
  end;
end;

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  Memo1.Lines.Text:= StringGrid1.Cells[ACol,ARow];
end;

procedure TForm1.Memo1Exit(Sender: TObject);
begin
  if not TabPressed then
   StringGrid1.Cells[StringGrid1.Col,StringGrid1.Row]:=  Memo1.Lines.Text;
  TabPressed:= False;
end;


end.

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita