![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#3
|
|||
|
|||
|
Aquí pongo el código:
{/* INSERTAMOS LAS DIFERENTES IMPRESORAS INSTALADAS EN EL EQUIPO DENTRO DE LA REJILLA. */} procedure TForm_Main.FormCreate(Sender: TObject); begin TotalImpre := 0; if UpperCase(ParamStr(1)) = 'S' then Caption := 'Configuración de impresoras - SURDIST' else Caption := 'Configuración de impresoras - SURGEST'; {/* Procedemos a dibujar la rejilla de datos. */} Configurar_Rejilla; end; {/* ACCIÓN DE PULSAR EL BOTÓN ACEPTAR DE LA APLICACIÓN. */} procedure TForm_Main.bAceptarClick(Sender: TObject); begin {/* Inicializamos la variable que corresponde al número de impresora. */} numImpresora := 0; {/* Abrimos el fichero SSECFGIM.DAT y procedemos a insertar los datos en dicho fichero. */} AssignFile(FicheroDatos, ExtractFilePath(ParamStr(0)) + 'SSECFGIM.DAT'); ReWrite(FicheroDatos); Append(FicheroDatos); {/* Procedimiento encargado de configurar los diferentes parametros de las impresoras existentes en la aplicacion. */} Configura_Impresora; {/* Procedimiento encargado de configurar los diferentes visores según halla elegido el usuario. */} Configura_Visores; {/* Cerramos el fichero grabando la configuración y seguidamente cerramos la aplicación. */} CloseFile(FicheroDatos); Close; end; {/* PROCEDIMIENTO CON EL QUE COMPROBAMOS QUE VISORES ESTÁN SELECCIONADOS Y DE ESTOS ULTIMOS LOCALIZAMOS LA RUTA DONDE ESTÁN DICHOS FICHEROS. */} procedure TForm_Main.Configura_Visores; var nImpre : String; begin {/* EDITOR DE MS-DOS */} if ckDOS.Checked then begin Inc(numImpresora); {/* Aumentamos el contador de la impresora. */} nImpre := IntToStr(numImpresora); {/* Buscamos la ruta del fichero dentro de la carpeta Windows. */} Ruta := RutaWindows('EDIT.COM'); {/* Si la ruta devuelve algún valor, grabamos dicha ruta en el fichero, si no, omitimos dicha línea como si el usuario no la hubiera marcado. */} if Ruta <> '' then GrabarRegistro(nImpre,'Editor de MS-DOS','Pantalla',Ruta + ' $$$', '66',ObtenerVarEntorno('MACHINE'),'','','','',''); end; {/* BLOC DE NOTAS */} if ckNotepad.Checked then begin Inc(numImpresora); {/* Aumentamos el contador de la impresora. */} nImpre := IntToStr(numImpresora); {/* Buscamos la ruta del fichero dentro de la carpeta de Windows */} Ruta := RutaWindows('NOTEPAD.EXE'); {/* Si la ruta devuelve algún valor, grabamos dicha ruta en el fichero, si no, omitimos dicha línea como si el usuario no la hubiera marcado. */} if Ruta <> '' then GrabarRegistro(nImpre,'Bloc de Notas','Pantalla',Ruta + ' $$$', '66',ObtenerVarEntorno('MACHINE'),'','','','',''); end; {/* VISOR SUR */} if ckSur.Checked then begin Inc(numImpresora); {/* Aumentamos el contador de la impresora. */} nImpre := IntToStr(numImpresora); {/* Buscamos la ruta del fichero dentro de la ruta que indica la variable de entorno TRANSDIR. */} Ruta := RastreaDir('VISOR.EXE'); {/* Si la ruta devuelve algún valor, grabamos dicha ruta en el fichero, si no, omitimos dicha línea como si el usuario no la hubiera marcado. */} if Ruta <> '' then GrabarRegistro(nImpre,'Visor Sur','Pantalla',Ruta + ' $$$', '66',ObtenerVarEntorno('MACHINE'),'','','','',''); end; {/* VISOR MULTIBASE */} if ckMultibase.Checked then begin Inc(numImpresora); {/* Aumentamos el contador de la impresora. */} nImpre := IntToStr(numImpresora); {/* Grabamos dicho registro dentro del fichero. */} GrabarRegistro(nImpre,'Pantalla Multibase','Pantalla','', '66',ObtenerVarEntorno('MACHINE'),'','','','',''); end; end; {/* PROCEDIMIENTO SENCILLO QUE SIMPLEMENTE GRABA EN EL FICHERO LOS DATOS RECIBIDOS APLICANDOLES UN CIERTO FORMATEO Y ORDEN. */} procedure TForm_Main.GrabarRegistro(Var1,Var2,Var3,Var4,Var5,Var6, Var7,Var8,Var9,Var10,Var11 : String); begin WriteLn(FicheroDatos, Var1 + '|' + Var2 + '|' + Var3 + '|' + Var4 + '|' + Var5 + '|' + Var6 + '|' + Var7 + '|' + Var8 + '|' + Var9 + '|' + Var10 + '|' + Var11); end; procedure TForm_Main.GridLPTSelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean); var R : TRect; begin {/* En caso que la columna seleccionada sea la nº 3 entonces ponemos la rejilla en modo de edición. */} if ((ACol = 3) and (ARow <> 0)) then begin LineaAnt := ARow; ValorAnt := GridLPT.Cells[3,ARow]; GridLPT.Options := [goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine, goRowSizing,goColSizing,goEditing]; end else begin GridLPT.Options := [goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine, goRowSizing,goColSizing,goEditing]; end; {/* Proceso para mostrar dentro de la rejilla un componente Combo. */} if ((ACol = 4) and (ARow <> 0)) then begin CkGrafica.Visible := False; {/* Quitamos el otro componente. */} {/* Tamaño y posición del ComboBox para llenar la celdilla. */} R := GridLPT.CellRect(ACol, ARow); R.Left := R.Left + GridLPT.Left; R.Right := R.Right + GridLPT.Left; R.Top := R.Top + GridLPT.Top; {/* Mostramos el ComboBox. */} with ComboTipo do begin Left := R.Left + 1; Top := R.Top + 1; Width := (R.Right + 1) - R.Left; Height := (R.Bottom + 1) - R.Top; Style := csDropDown; ItemIndex := Items.IndexOf(GridLPT.Cells[ACol, ARow]); Visible := True; SetFocus; end; end; {/* Proceso para mostrar dentro de la rejilla un componente Check. */} if ((ACol = 5) and (ARow <> 0)) then begin ComboTipo.Visible := False; {/* Quitamos el otro componente. */} {/* Tamaño y posición del ComboBox para llenar la celdilla. */} R := GridLPT.CellRect(ACol, ARow); R.Left := R.Left + GridLPT.Left; R.Right := R.Right + GridLPT.Left; R.Top := R.Top + GridLPT.Top; {/* Mostramos el ComboBox. */} with CkGrafica do begin Left := R.Left + 3; Top := R.Top + 3; Width := 13; Height := 17; {/* Comprobamos que valor está incluido dentro de la celda. Si el valor es 'Sí' marcamos el check, y si es 'No' no lo checkeamos. */} if GridLPT.Cells[ACol, ARow] = 'Sí' then Checked := True else Checked := False; Visible := True; SetFocus; end; end; if (ACol <> 5) and (ACol <> 4) then begin CkGrafica.Visible := False; ComboTipo.Visible := False; end; Application.ProcessMessages; CanSelect := True; end; {/* Procedimiento con el que conseguimos que se introduzca dentro de la rejilla el valor seleccionado en el Combo. */} procedure TForm_Main.ComboTipoChange(Sender: TObject); var intRow, Opcion : Integer; Anterior : String; begin inherited; {/* Obtenemos la selección del Combo y la colocamos en la rejilla. */} with ComboTipo do begin intRow := GridLPT.Row; Anterior := GridLPT.Cells[4, intRow]; if (GridLPT.Col = 4) then GridLPT.Cells[4, intRow] := Items[ItemIndex] else GridLPT.Cells[GridLPT.Col, intRow] := Items[ItemIndex]; Visible := False; end; {/* Si la opción que pone en pantalla es Matricial, mostramos una ventana que solicite al usuario si desea que la impresora tenga modo gráfico o no. */} if (GridLPT.Cells[4, intRow] = 'Matricial') and (GridLPT.Cells[2, intRow] = 'PRINTMAN') then begin Opcion := MessageDlg('¿Desea que esta impresora use el modo gráfico?', mtConfirmation, mbYesNoCancel, 0); case Opcion of 2: GridLPT.Cells[4, intRow] := Anterior; 6: GridLPT.Cells[5, intRow] := 'Sí'; 7: GridLPT.Cells[5, intRow] := 'No'; end; end; GridLPT.SetFocus; end; procedure TForm_Main.CkGraficaClick(Sender: TObject); var intRow : Integer; begin inherited; {/* Obtenemos la opción del Check y lo colocamos en la rejilla. */} with CkGrafica do begin intRow := GridLPT.Row; if (GridLPT.Col = 5) then begin if Checked then GridLPT.Cells[5, intRow] := 'Sí' else GridLPT.Cells[5, intRow] := 'No'; end; Visible := False; end; GridLPT.SetFocus; end; procedure TForm_Main.GridLPTDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); const AlignFlags : array [TAlignment] of Integer = (DT_LEFT or DT_VCENTER or DT_WORDBREAK or DT_EXPANDTABS or DT_NOPREFIX, DT_RIGHT or DT_VCENTER or DT_WORDBREAK or DT_EXPANDTABS or DT_NOPREFIX, DT_CENTER or DT_VCENTER or DT_WORDBREAK or DT_EXPANDTABS or DT_NOPREFIX); var s : String; begin inherited; with Rect do begin Left := Left + 2; Top := Top + 2; Right := Right - 5; end; s := GridLPT.Cells[ACol, ARow]; if (ARow = 0) and (ACol < GridLPT.ColCount) then begin GridLPT.Canvas.Font.Style := GridLPT.Canvas.Font.Style + [fsBold]; GridLPT.Canvas.Brush.Color := GridLPT.FixedColor; GridLPT.Canvas.FillRect(Rect); DrawText(GridLPT.Canvas.Handle, pChar(s), Length(s), Rect, AlignFlags[taCenter]); end else if (ACol = 0) and (ARow > 0) and (ARow < GridLPT.ColCount) then begin GridLPT.Canvas.FillRect(Rect); DrawText(GridLPT.Canvas.Handle, pChar(s), Length(s), Rect, AlignFlags[taRightJustify]); end; end; He puesto el código que creo puede interesar, si ves tambien pongo un check y en este caso si se muestra cuando pulos la celda. Espero te pueda ayudar para poder ayudarme. Gracias |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Refresh en Grid con un TiBQuery como datasource | ZRR | Firebird e Interbase | 3 | 03-10-2005 16:25:32 |
| Como paso un Tstring a String | Antuan | Varios | 18 | 13-08-2005 01:44:02 |
| Como Borra exclusivamente una fila en un String Grid | mgaray | Varios | 1 | 14-03-2005 22:06:57 |
| string grid | rebollo75 | Varios | 4 | 27-12-2004 20:10:47 |
| deployment descriptor | Aileen | JAVA | 0 | 08-07-2004 22:40:38 |
|