我正在尝试在FireMonkey中的TListBox中启用TListBoxItems的拖放。它似乎有时会拖放,但有时它甚至不会进入事件处理程序
procedure TForm1.ListBox1DragChange(SourceItem, DestItem: TListBoxItem; var Allow: Boolean);
begin
SourceItem.Index := DestItem.Index;
end;
我将DragMode设为dmManual
object ListBox1: TListBox
Height = 200.000000000000000000
Position.X = 224.000000000000000000
Position.Y = 144.000000000000000000
TabOrder = 1
Width = 200.000000000000000000
AllowDrag = True
Items.Strings = (
'First'
'Second'
'Third'
'Fourth'
'Fifth'
'Sixth')
DefaultItemStyles.ItemStyle = ''
DefaultItemStyles.GroupHeaderStyle = ''
DefaultItemStyles.GroupFooterStyle = ''
OnDragChange = ListBox1DragChange
end