Ver Mensaje Individual
  #4  
Antiguo 17-11-2014
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
obum1,

Cita:
Empezado por obum1
...tengo una problema con los inifiles a la hora de que el programa lo lea...no carga todo el string...a un edit...


Pregunto:

1- ¿Que versión de Windows y Delphi utilizas?.

2- ¿El componente TEdit en cuestión, tiene la propiedad MaxLength con algún valor diferente de cero?.

3- ¿Has hecho un debug para verificar si los valores son leídos correctamente del archivo .ini?

4- ¿Puedes publicar el código real que usas en el programa?, el código que publicastes en el Msg #3 no es el correcto

Revisa este código:
Código Delphi [-]
// GUARDANDO OPCIONES EN UN ARCHIVO INI

procedure TFPrincipal.GuardarINI;
var INI: TIniFile;
begin
  // Creamos el archivo INI
  INI := TINIFile.Create( ExtractFilePath( Application.ExeName ) + 'opciones.ini' );

  // Guardamos las opciones
  INI.WriteString( 'OPCIONES', 'IMPRESORA', IMPRESORA.Text );
  INI.WriteInteger( 'OPCIONES', 'COPIAS', COPIAS.Value );
  INI.WriteBool( 'OPCIONES', 'VISTAPREVIA', VISTAPREVIA.Checked );
  INI.WriteDate( 'OPCIONES', 'FECHA', FECHA.Date );
  INI.WriteTime( 'OPCIONES', 'HORA', StrToTime( HORA.Text ) );
  INI.WriteFloat( 'OPCIONES', 'MARGEN', MARGEN.Value );

  // Al liberar el archivo INI se cierra el archivo opciones.ini
  INI.Free;
end;

// CARGANDO OPCIONES DE UN ARCHIVO INI

procedure TFPrincipal.CargarINI;
var INI: TIniFile;
begin
  // Si no existe el archivo no hacemos nada
  if not FileExists( ExtractFilePath( Application.ExeName ) + 'opciones.ini' ) then
    Exit;

  // Creamos el archivo INI
  INI := TINIFile.Create( ExtractFilePath( Application.ExeName ) + 'opciones.ini' );

  // Guardamos las opciones
  IMPRESORA.Text := INI.ReadString( 'OPCIONES', 'IMPRESORA', '' );
  COPIAS.Value := INI.ReadInteger( 'OPCIONES', 'COPIAS', 0 );
  VISTAPREVIA.Checked := INI.ReadBool( 'OPCIONES', 'VISTAPREVIA', False );
  FECHA.Date := INI.ReadDate( 'OPCIONES', 'FECHA', Date );
  HORA.Text := TimeToStr( INI.ReadTime( 'OPCIONES', 'HORA', Time ) );
  MARGEN.Value := INI.ReadFloat( 'OPCIONES', 'MARGEN', 0.00 );

  // Al liberar el archivo INI se cierra el archivo opciones.ini
  INI.Free;
end;
Tomado de : Delphi al Límite - Guardando y cargando opciones

Espero sea útil

Nelson.
Responder Con Cita