Hi,
I want to drag&drop from a listview to a stringgrid. I have never attempted to code drag&drop before.
My listview is built up from a db query and each listitem contains a pointer to a record type.
Code for listview:
type RecordWO = ^TRecordWO;
TRecordWO = record
wonum : AnsiString;
desc : AnsiString;
schedstart : AnsiString;
schedfinish : AnsiString;
cnt : AnsiString;
var recWO : RecordWO;
newlistitem : TListItem;
listview1.Clear;
listview1.Columns[0].Caption := 'Work Order';
listview1.Columns[1].Caption := 'Description';
listview1.Columns[2].Caption := 'Scheduled Start';
listview1.Columns[3].Caption := 'Scheduled End';
listview1.Columns[4].Caption := 'Assignments';
While not query1.EOF do
begin
New(recWO);
recWO.wonum := FieldByName('wonum').AsString;
recWO.desc := FieldByName('description').AsString;
recWO.schedstart := FieldByName('schedstart').AsString;
recWO.schedfinish := FieldByName('schedfinish').AsString;
recWO.cnt := FieldByName('cnt').AsString;
newlistitem := lvWO.Items.Add;
newlistitem.Data := recWO;
newlistitem.Caption := FieldByName('wonum').AsString;
newlistitem.SubItems.Add(FieldByName('description').AsString);
newlistitem.SubItems.Add(FieldByName('schedstart').AsString);
newlistitem.SubItems.Add(FieldByName('schedfinish').AsString);
newlistitem.SubItems.Add(FieldByName('cnt').AsString);
Next;
end;
OK, what needs to be done on the stringgrid side (and on the listview side) to accept the drop from the listview
and after the drop to display the recWO.desc in the dropped cell?
I know it is probably a lot of code, but please help me out.
Regards
I want to drag&drop from a listview to a stringgrid. I have never attempted to code drag&drop before.
My listview is built up from a db query and each listitem contains a pointer to a record type.
Code for listview:
type RecordWO = ^TRecordWO;
TRecordWO = record
wonum : AnsiString;
desc : AnsiString;
schedstart : AnsiString;
schedfinish : AnsiString;
cnt : AnsiString;
var recWO : RecordWO;
newlistitem : TListItem;
listview1.Clear;
listview1.Columns[0].Caption := 'Work Order';
listview1.Columns[1].Caption := 'Description';
listview1.Columns[2].Caption := 'Scheduled Start';
listview1.Columns[3].Caption := 'Scheduled End';
listview1.Columns[4].Caption := 'Assignments';
While not query1.EOF do
begin
New(recWO);
recWO.wonum := FieldByName('wonum').AsString;
recWO.desc := FieldByName('description').AsString;
recWO.schedstart := FieldByName('schedstart').AsString;
recWO.schedfinish := FieldByName('schedfinish').AsString;
recWO.cnt := FieldByName('cnt').AsString;
newlistitem := lvWO.Items.Add;
newlistitem.Data := recWO;
newlistitem.Caption := FieldByName('wonum').AsString;
newlistitem.SubItems.Add(FieldByName('description').AsString);
newlistitem.SubItems.Add(FieldByName('schedstart').AsString);
newlistitem.SubItems.Add(FieldByName('schedfinish').AsString);
newlistitem.SubItems.Add(FieldByName('cnt').AsString);
Next;
end;
OK, what needs to be done on the stringgrid side (and on the listview side) to accept the drop from the listview
and after the drop to display the recWO.desc in the dropped cell?
I know it is probably a lot of code, but please help me out.
Regards