Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Lazarus, FreePascal, Kylix, etc. (https://www.clubdelphi.com/foros/forumdisplay.php?f=14)
-   -   DriveComboBox para Lazarus (https://www.clubdelphi.com/foros/showthread.php?t=61245)

viveba 31-10-2008 10:04:47

DriveComboBox para Lazarus
 
Hola a todos.

Quisiera saber si existe para Lazarus algún componente similar al DriveComboBox de Delphi, o de que manera puedo simularlo.

Desde ya, muchas gracias a todos.

rretamar 31-10-2008 16:55:15

Hola.
Desconozco si existe algo así. Pero tiene sentido que no se incluya nativamente, ya que el concepto de unidad de disco (A, B, C, D, etc.) no existe en otros sistemas operativos como LINUX, y Lazarus (que funciona bajo Linux, entre otros S.O.) está pensado para ser multiplataforma en la medida de lo posible.

Saludos !

viveba 01-11-2008 10:28:30

DriveComboBox
 
Gracias por responder.

cHackAll 04-11-2008 02:47:08

Dispositivos montados:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
 Str: string;
 Index, Pos: Integer;
begin
 ListBox1.Items.LoadFromFile('/etc/mtab');
 Index := 0;
 while Index < ListBox1.Count do
  begin
   Str := ListBox1.Items[Index];
   if Copy(Str, 1, 5) <> '/dev/' then
    ListBox1.Items.Delete(Index)
   else
    begin
     Pos := System.Pos(' ', Str);
     repeat Inc(Pos);
     until Str[Pos] = ' ';
     ListBox1.Items[Index] := Copy(Str, 1, Pos);
     Inc(Index);
    end;
  end;
end;

Dispositivos según sistema de archivos:

Código Delphi [-]
procedure TForm1.Button2Click(Sender: TObject);
var
 Str: string;
 Index, Pos: Integer;
begin
 ListBox1.Items.LoadFromFile('/etc/fstab');
 Index := 0;
 while Index < ListBox1.Count do
  begin
   Str := ListBox1.Items[Index];
   if (Str <> '') and (Str[1] = '#') then
    if (Index < (ListBox1.Count - 1)) and (Copy(ListBox1.Items[Index + 1], 1, 5) = 'UUID=') then
     begin
      Str := Copy(Str, 3, 255) + Copy(ListBox1.Items[Index + 1], 42, 255);
      ListBox1.Items.Delete(Index + 1);
     end
    else
     Str := '';
   if (Str = '') or (Str[1] <> '/') then
    ListBox1.Items.Delete(Index)
   else
    begin
     repeat Pos := System.Pos('  ', Str);
      if Pos <> 0 then
       Delete(Str, Pos, 1);
     until Pos = 0;
     Pos := System.Pos(' ', Str); // just the physical device and the mount point.
     repeat Inc(Pos);
     until Str[Pos] = ' ';
     ListBox1.Items[Index] := Copy(Str, 1, Pos);
     Inc(Index);
    end;
  end;
end;

Saludos

viveba 04-11-2008 13:59:16

Agradecimientos
 
Muchisimas gracias!!! yo mismo lo pruebo.


La franja horaria es GMT +2. Ahora son las 05:58:55.

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