//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "TStringsMove.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: TStringsMove
// Property: Controls.TCustomMultiSelectListControl.MultiSelect
// Property: Controls.TCustomListControl.ItemIndex
// Method: Classes.TStrings.Move

// BeginCode
/*
This example uses a list box and a button on a form. The
list box contains items when the form appears. When the user
selects an item and clicks the button, the selected item in
the list box is moved to the top of the list box:
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  ListBox1->MultiSelect = false;
  Button1->Caption = "Move to Top";
  for (int i = 1; i <= 10; i++)
    ListBox1->Items->Add("Item " + IntToStr(i));
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  if (ListBox1->ItemIndex >= 0 && ListBox1->ItemIndex <= 9)
	ListBox1->Items->Move(ListBox1->ItemIndex, 0);
}
// EndCode
// EndExample: TStringsMove
//---------------------------------------------------------------------------
