InsertTag Example for Delphi
var
nRet: Integer;
ItemX: TListItem;
strItem: String;
nLen: Integer;
x: Integer;
strItemL: String;
strItemR: String;
begin
LEADDicomDS1.EnableMethodErrors:= False;
nRet:= LEADDicomDS1.FindTag (131079);
if(nRet = 0)then
begin
ShowMessage('Already Exists!');
Exit;
end;
nRet:= LEADDicomDS1.InsertTag(131079, -1, 'My Test Tag', VR_OB, 1, 1, 1);
if(nRet <> 0)then
begin
ShowMessage('Error');
Exit;
end;
LEADDicomDS1.EnableMethodErrors:= True;
//add item to the ListView control
ItemX:= ListView1.Items.Add();
strItem:= IntToStr(LEADDicomDS1.DefaultInterface.Get_CurrentTag().Code);
nLen:= Length(strItem);
strItemR:= RightStr(strItem, 4);
strItemL:= '';
for x:= nLen to 7 do
strItemL:= strItemL + IntToStr(0);
strItemL:= strItemL + LeftStr(strItem, nLen - 4);
ItemX.Caption:= strItemL + ':' + strItemR;
strItem:= IntToStr(LEADDicomDS1.DefaultInterface.Get_CurrentTag().Mask);
nLen:= Length(strItem);
strItemR:= RightStr(strItem, 4);
strItemL:= '';
for x:= nLen to 7 do
strItemL:= strItemL + IntToStr(0);
strItemL:= strItemL + LeftStr(strItem, nLen - 4);
ItemX.SubItems[1]:= strItemL + ':' + strItemR;
ItemX.SubItems[2]:= LEADDicomDS1.DefaultInterface.Get_CurrentTag().Name;
ItemX.SubItems[3]:= IntToStr(LEADDicomDS1.DefaultInterface.Get_CurrentTag().VR);
ItemX.SubItems[4]:= IntToStr(LEADDicomDS1.DefaultInterface.Get_CurrentTag().MinVM);
ItemX.SubItems[5]:= IntToStr(LEADDicomDS1.DefaultInterface.Get_CurrentTag().MaxVM);
ItemX.SubItems[6]:= IntToStr(LEADDicomDS1.DefaultInterface.Get_CurrentTag().DivideVM);
ListView1.Selected:= ItemX;
ListView1.Refresh();
ListView1.SetFocus();
end;