Ver Mensaje Individual
  #7  
Antiguo 31-05-2008
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.210
Reputación: 22
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Bueno, no existe ningún bug. He hecho una prueba con delphi 6:

Código Delphi [-]
procedure TForm1.FormActivate(Sender: TObject);
begin
    ListBox1.Items.Add('A');
    ListBox1.Items.Add('AB');
    ListBox1.Items.Add('AC');
    ListBox1.Items.Add('B');
    ListBox1.Items.Add('BA');
    ListBox1.Items.Add('C');
    ListBox1.Sorted := true;
    end;

end.



si no colocas ListBox1.Sorted := true; funciona como tu dices.

En definitiva tu codigo c tiene algún error y ademas falta ListBox1->Sorted = true;

Sería algo así:
Código:
void __fastcall TForm1::FormActivate(TObject *Sender)
{
  ListBox1->Items->Add("A");
  ListBox1->Items->Add("AB");
  ListBox1->Items->Add("AC");
  ListBox1->Items->Add("B");
  ListBox1->Items->Add("BA");
  ListBox1->Items->Add("C");
  ListBox1->Sorted=true;
}
Aquí te dejo el ejemplo:

Saludos.

EDITO: mira esto también:
Código:
void __fastcall TForm1::FormActivate(TObject *Sender)
{
    TStringList  *Lista  = new TStringList;

    Lista->Add("A");
    Lista->Add("AB");
    Lista->Add("AC");
    Lista->Add("B");
    Lista->Add("BA");
    Lista->Add("C");

    Lista->Sorted = true;

    ListBox1->Items->Text = Lista->Text;

    // Prueba con esta línea y sin ella:
    ListBox1->Sorted = true;

    delete Lista;

}

Última edición por escafandra fecha: 31-05-2008 a las 22:17:27.
Responder Con Cita