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

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 04-01-2008
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 19.455
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Si no recuerdo mal, el truco número 15 lista todos los ficheros de un directorio hacia un TStrings, a partir de la ruta del directorio.
Basta con que a cada línea le apliques un ExtractFileName para desechar el path y quedarte sólo con el nombre y luego hacer un Add para añadilo al combo.

No se si me expliqué bien...
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #2  
Antiguo 04-01-2008
Avatar de enecumene
[enecumene] enecumene is offline
Miembro de Oro
 
Registrado: may 2006
Ubicación: Santo Domingo, Rep. Dom.
Posts: 3.040
Poder: 24
enecumene Va por buen camino
Vale no te preocupes ahora mismo revisare el truco 15 y luego te comento.

Saludos.
__________________

Mi BLOG - ¡Joder, leanse la guia de estilo!
Las Palabras son enanas, los ejemplos gigantes.
Responder Con Cita
  #3  
Antiguo 04-01-2008
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 19.455
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Me refería a algo así, vamos...

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
  TS:TStrings;
  i:Integer;


  procedure ArchivosDirectorio(dir, mascara: string;
    var lista: TStrings; const soloNombres: boolean);
  var
    SR: TSearchRec;
  begin
    dir := IncludeTrailingPathDelimiter(dir);
    if FindFirst(dir + mascara, faAnyFile, SR) = 0 then
    begin
      repeat
        if not soloNombres then
          lista.Add(ExtractFileName(ChangeFileExt(dir + SR.Name, '')))
        else
          lista.Add(dir + SR.Name);
      until FindNext(SR) <> 0;
      SysUtils.FindClose(SR);
    end;
  end;

begin

  TS := TStringList.Create();
  try
    ArchivosDirectorio(Edit1.Text, '*.bmp', TS, True);

    for i := 0 to (TS.Count - 1) do begin
      TS.Strings[i] := ExtractFileName(TS.Strings[i]);
    end;


    ComboBox1.Items.Clear;
    ComboBox1.Items.AddStrings(TS);
    ComboBox1.ItemIndex := 0;

  finally
    FreeAndNil(TS);
  end;

end;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita
  #4  
Antiguo 04-01-2008
Avatar de enecumene
[enecumene] enecumene is offline
Miembro de Oro
 
Registrado: may 2006
Ubicación: Santo Domingo, Rep. Dom.
Posts: 3.040
Poder: 24
enecumene Va por buen camino
Excelente Amigo Neftali me funcionó perfecto era lo que estaba buscando, estaba haciendo algo asi con el truco 15:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin
procedure FindFiles(StartDir, FileMask: string; recursively: boolean; var FilesList: TStringList);
  const
    MASK_ALL_FILES = '*.*';
    CHAR_POINT = '.';
  var
    SR: TSearchRec;
    DirList: TStringList;
    IsFound: Boolean;
    i: integer;
  begin
    if (StartDir[length(StartDir)] <> '\') then begin
      StartDir := StartDir + '\';
    end;
  
    // Crear la lista de ficheos en el directorio StartDir (no directorios!)
    IsFound := FindFirst(StartDir + FileMask, faAnyFile - faDirectory, SR) = 0;
    // MIentras encuentre
    while IsFound do  begin
      FilesList.Add(StartDir + SR.Name);
      IsFound := FindNext(SR) = 0;
    end;
  
    FindClose(SR);
  
    // Recursivo?
    if (recursively) then begin
      // Build a list of subdirectories
      DirList := TStringList.Create;
      // proteccion
      try
        IsFound := FindFirst(StartDir + MASK_ALL_FILES, faAnyFile, SR) = 0;
        while IsFound do
        begin
          if ((SR.Attr and faDirectory) <> 0) and
            (SR.Name[1] <> CHAR_POINT) then
            DirList.Add(StartDir + SR.Name);
          IsFound := FindNext(SR) = 0;
        end;
        FindClose(SR);
  
        // Scan the list of subdirectories
        for i := 0 to DirList.Count - 1 do
          FindFiles(DirList[i], FileMask, recursively, FilesList);
      finally
        DirList.Free;
      end;
    end;
  end;
end;

Pero no me daba, con este ultimo codigo que posteaste me funciona excelente, Garcias Neftali por tu tiempo os agradezco.

Saludos.
__________________

Mi BLOG - ¡Joder, leanse la guia de estilo!
Las Palabras son enanas, los ejemplos gigantes.
Responder Con Cita
Respuesta


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
llenar un combobox fabian20s Conexión con bases de datos 13 30-11-2007 18:54:56
Llenar un ComboBox en delphi 7 arespremium Internet 14 05-08-2007 01:59:16
Llenar un combobox con los campos de una tabla enecumene Conexión con bases de datos 6 07-03-2007 21:42:28
llenar un combobox con datos de una tabla edelphi Conexión con bases de datos 4 28-02-2007 12:06:37
Como llenar este comboBox pzala Varios 2 14-12-2003 21:26:22


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


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