コード例 #1
0
void __fastcall TfrmSearch::lvParamsDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * SourItem = lvParams->Selected;
  TListItem * DestItem = lvParams->GetItemAt(X,Y);
  TListItem * TempItem = lvParams->Items->Add();
  TempItem->Assign(SourItem);
  SourItem->Assign(DestItem);
  DestItem->Assign(TempItem);
  lvParams->Items->Delete(TempItem->Index);
}
コード例 #2
0
void __fastcall TfrmReplaceRule::lvReplaceRulesDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * DestItem = lvReplaceRules->GetItemAt(X,Y);
  TListItem * Item     = lvReplaceRules->Selected;
  TListItem * NewItem  = lvReplaceRules->Items->Insert(DestItem->Index);
  NewItem->Assign(Item);
  lvReplaceRules->Items->Delete(Item->Index);
}
コード例 #3
0
void __fastcall TfrmBillFormat::lvFieldsDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * DestItem = lvFields->GetItemAt(X,Y);
  TListItem * Item     = lvFields->Selected;
  int SourIndex,DestIndex;
  SourIndex = Item->Index;
  DestIndex = DestItem->Index;
  TListItem * NewItem;
  if(SourIndex < DestIndex)
    NewItem  = lvFields->Items->Insert(DestIndex + 1);
  else
    NewItem  = lvFields->Items->Insert(DestIndex);
  NewItem->Assign(Item);
  _di_IXMLNode RecordNode = BillConfig->GetRecordNode(BillName);
  _di_IXMLNode SourNode   = BillConfig->GetFieldNode(BillName,Item->SubItems->Strings[0]);
  _di_IXMLNode DestNode   = BillConfig->GetFieldNode(BillName,DestItem->SubItems->Strings[0]);
  _di_IXMLNode TmpNode    = SourNode->CloneNode(true);
  //RecordNode->ChildNodes->Remove(DestNode);
  //RecordNode->ChildNodes->Insert(DestIndex,TmpNode);

  RecordNode->ChildNodes->Remove(SourNode);
  RecordNode->ChildNodes->Insert(DestIndex,TmpNode);
  lvFields->Items->Delete(Item->Index);
/*
  TListItem * DestItem = lvFields->GetItemAt(X,Y);
  TListItem * Item     = lvFields->Selected;
  int OldIndex = Item->Index;
  TListItem * NewItem  = lvFields->Items->Insert(DestItem->Index);
  int NewIndex = NewItem->Index;
  if(OldIndex < NewIndex)
    NewIndex -= 1;
  _di_IXMLNode RecordNode   = BillConfig->GetRecordNode(BillName);
  _di_IXMLNode OldFieldNode = BillConfig->GetFieldNode(BillName,Item->SubItems->Strings[0]);
  _di_IXMLNode NewFieldNode = OldFieldNode->CloneNode(true);
  RecordNode->ChildNodes->Delete(OldIndex);
  RecordNode->ChildNodes->Insert(OldIndex,NewFieldNode);

  NewItem->Assign(Item);
  lvFields->Items->Delete(Item->Index);
*/
}
コード例 #4
0
void __fastcall TfrmBillConfig::lvBillsDragDrop(TObject *Sender,
      TObject *Source, int X, int Y)
{
  TListItem * DestItem = lvBills->GetItemAt(X,Y);
  TListItem * Item     = lvBills->Selected;
  int SourIndex,DestIndex;
  SourIndex = Item->Index;
  DestIndex = DestItem->Index;
  TListItem * NewItem;
  if(SourIndex < DestIndex)
    NewItem  = lvBills->Items->Insert(DestIndex + 1);
  else
    NewItem  = lvBills->Items->Insert(DestIndex);
  NewItem->Assign(Item);
  _di_IXMLNode SourNode  = BillConfig->GetBillNode(Item->SubItems->Strings[0]);
  _di_IXMLNode TmpNode   = SourNode->CloneNode(true);

  BillConfig->BillRootNode->ChildNodes->Remove(SourNode);
  BillConfig->BillRootNode->ChildNodes->Insert(DestIndex,TmpNode);
  lvBills->Items->Delete(Item->Index);
}