igornastoski
Technical User
Hi,
let me explain my problem.I have one ListBox (ListBox1 with several Items). I would like to rearrange Item's starting position (in the same ListBox1) in random order. I have tried to solve my problem with drag&drop operation but in that way, selected Item will always be placed at the end of the column (the others will just move one position up), and not in a position where I draged it. After using the OnMouseDown and OnDragDrop event I've created an OnDragDrop event with code (here is the problem I think):
void_fastcall TForm1::ListBox1DragDrop(TObject *Sender, TObject *Source, int X, int Y)
{
TListBox *sender=(TListBox *) Sender;
TListBox *source=(TListBox *) Source;
sender->Items->Add(source->Items->Strings[source->ItemIndex]);
source->Items->Delete(source->ItemIndex);
}
Is there some other solution for that?
Thanks, for helping me out.
best Regards,
Igor
let me explain my problem.I have one ListBox (ListBox1 with several Items). I would like to rearrange Item's starting position (in the same ListBox1) in random order. I have tried to solve my problem with drag&drop operation but in that way, selected Item will always be placed at the end of the column (the others will just move one position up), and not in a position where I draged it. After using the OnMouseDown and OnDragDrop event I've created an OnDragDrop event with code (here is the problem I think):
void_fastcall TForm1::ListBox1DragDrop(TObject *Sender, TObject *Source, int X, int Y)
{
TListBox *sender=(TListBox *) Sender;
TListBox *source=(TListBox *) Source;
sender->Items->Add(source->Items->Strings[source->ItemIndex]);
source->Items->Delete(source->ItemIndex);
}
Is there some other solution for that?
Thanks, for helping me out.
best Regards,
Igor