MoveSelection .. 이런 메소드가 ListBox에 있었군요
전체를 옮기려면 SelectAll 한뒤에 MoveSelection 하면 되겠네요
void __fastcall TForm1::Button2Click(TObject *Sender)
{
ListBox1->SelectAll();
ListBox1->MoveSelection(ListBox2);
}
근데 SeletAll해도 전체가 Select 되지 않는경우가 있는데
ListBox에 MultiSelect 라는 property가 있는데
이놈이 true 로 되어있어야 SelectAll이 먹힙니다.
MultiSelect 속성과 관계없이
다음과 같이 코딩으로도 가능하겠네요
void __fastcall ListBoxMoveAll(TListBox *SrcListBox,TListBox *DestListBox)
{
for( int i=0;iCount;i++)
DestListBox->Items->AddObject(SrcListBox->Items->Strings[i],SrcListBox->Items->Objects[i]);
SrcListBox->Items->Clear();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
ListBoxMoveAll(ListBox1,ListBox2);
}
그럼...
긴카페 님이 쓰신 글 :
: ListBox1->MoveSelection(ListBox2);
:
: 이게 지금 리스트박스1에 있는것을 리스트박스2로 옴기는 거잖아요
:
: 근데 전체를 옴길려면 SelectAll을 써야하잖아요,
:
: 근데 어떻게 해야하는지 잘 모르겠습니다.,
|