Ver Mensaje Individual
  #1  
Antiguo 02-09-2006
gsilvei gsilvei is offline
Miembro
 
Registrado: jul 2006
Posts: 44
Reputación: 0
gsilvei Va por buen camino
trabajando con 2 listbox

Hola, a todos, tengo la siguiente duda, por alli en el foro encontre un hilo con una procedure que recorre un listbox, yo quiero trabajar con 2 listbox, pero me gustaria que al recorrer el listbox, el no comienze desde el primer item, y si que recorra el listbox junto a otro listbox, es decir...que el listbox2 y listbox 4, recorran juntos con cada clique, y de alguna forma que el item del listbox2 sea igual al item del listbox4.
espero haber explicado bien..

aqui hago doble clique en el listbox1 y el carga en 3 listbox mas las siguientes .txt.....

Código Delphi [-]
procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
  if ListBox1.ItemIndex = 0 then
    begin
       ListBox2.Clear;
       ListBox2.Items.LoadFromFile('C:\IPCapitulo.txt');
       ListBox3.Items.LoadFromFile('C:\IPArquivo.txt');
       ListBox4.Items.LoadFromFile('C:\IPMaximizada.txt');
    end;  
end;
y despues por medio de un "SpeedButtom" recorro los item de los listbox.




Código Delphi [-]
{$WRITEABLECONST ON}
procedure TForm1.SpeedButton2Click(Sender: TObject);
const
  i: integer = 0;
begin
   with ListBox3.Items do
    begin
      if ListBox3.ItemIndex < Count-1
         then ListBox2.ItemIndex := ListBox2.ItemIndex + 1
         else MessageDlg('Final del curso !',mtInformation,[mbOk],0);
         Panel2.Caption := ListBox2.Items.Strings[ListBox2.ItemIndex];
         WebBrowser1.Navigate(strings[ListBox2.ItemIndex]);
    end;
  begin
  with ListBox4 do
   begin
    if i < Count then
      if Items[i] = 'N' then
      begin
        Self.Height := 300;
        Self.Width := 500;
        Self.Left := 400;
        Self.Top := 400;
      end;
    if i < Count-1 then
      inc(i)
    else
      i:= ListBox2.ItemIndex;
   end;
  end;
end;
{$WRITEABLECONST OFF}

agradezco por la ayuda, ya que debo finalizar un proyecto.Saludos
Responder Con Cita