Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 09-04-2008
camino camino is offline
Miembro
 
Registrado: feb 2007
Posts: 48
Poder: 0
camino Va por buen camino
Al fin la SOLUCION

Cuando capturaba el componente a traves del boton derecho del mouse, era la instruccion FindControl que me colocaba el nombre en una variable.

Pero como bien saben Uds no podia hacer lo contrario.

Pues bien nunca colocar las rutinas en un Form.Activate o en un Form.Show.

Aqui van las rutinas:

Código Delphi [-]

procedure TPuntodeVentaForm.FormActivate(Sender: TObject);
var
LastRow : Integer;
begin
LimpiaGrilla;
with datamodule2 do
begin
 IbQuery3.Close;
 IbQuery3.SQL.Clear;
 IbQuery3.SQL.Add('Select * from MenuTeclas where Id_Producto <> 0');
 IbQuery3.Prepare;
 IbQuery3.Open;
 if IbQuery3.EOF then
  Exit;
 IbQuery3.First;
 LastRow := 0;
 while not IbQuery3.EOF do
 begin
  Inc(LastRow);
  if  LastRow > 1 then
   StringGrid2.RowCount := StringGrid2.RowCount + 1;
  StringGrid2.Cells[0,LastRow] := IbQuery3.FieldByName('Id_Tecla').asString;
  StringGrid2.Cells[1,LastRow] := IbQuery3.FieldByName('Linea1').asString;
  StringGrid2.Cells[2,LastRow] := IbQuery3.FieldByName('Linea2').asString;
  StringGrid2.Cells[3,LastRow] := IbQuery3.FieldByName('Linea3').asString;
  StringGrid2.Cells[4,LastRow] := IbQuery3.FieldByName('Linea4').asString;
  IbQuery3.Next;
 end;
 IbQuery3.Close;
end;
end;



procedure TPuntodeVentaForm.FormShow(Sender: TObject);
var
a : Integer;
RichMemo :TComponent;
Nombre : string;
begin
  MessageDlg('Click para cargar variables',mtInformation, [mbOk],0);
  Button2.Perform(WM_LButtonDown,0,0);
  Sleep(250);
  Button2.Perform(WM_LButtonUp,0,0);
 end;
end;


procedure TPuntodeVentaForm.Button2Click(Sender: TObject);
var
RichMemo :TComponent;
Nombre : string;
a : Integer;
begin
 For a := 1 to StringGrid2.RowCount -1 do
 begin
  Nombre := StringGrid2.Cells[0,a];
  RichMemo := FindComponent(Nombre) as TRichEdit;
  TRichEdit(RichMemo).Clear;
  TRichEdit(RichMemo).Paragraph.Alignment:=TaCenter;
  TRichEdit(RichMemo).Lines.Add(StringGrid2.Cells[1,a]);
  TRichEdit(RichMemo).Lines.Add(StringGrid2.Cells[2,a]);
  TRichEdit(RichMemo).Lines.Add(StringGrid2.Cells[3,a]);
  TRichEdit(RichMemo).Lines.Add(StringGrid2.Cells[4,a]);
 end;
end;

Por favor analizar y corregir si es posible
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Usar Nombre Componente en variable camino OOP 3 07-04-2008 17:18:58
Variable en el nombre de la Tabla carlosegs11 SQL 1 16-06-2006 23:32:47
Select con nombre de tabla Variable mayte mtz SQL 4 25-04-2006 16:13:35
¿Como saber el nombre de la variable de un form? fjavier64 OOP 1 04-03-2005 17:29:35


La franja horaria es GMT +2. Ahora son las 22:01:22.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi