MoveRootElement Example for Delphi
procedure TForm1.DSDeleteModuleClick(Sender: TObject);
var
nRet1: Integer;
nRet2: Integer;
begin
LEADDicomDS1.EnableMethodErrors:= True;
//move to first element in Data Set
LEADDicomDS1.MoveFirstElement (False);
LEADDicomDS1.FindTag (LEADDicomDS1.DefaultInterface.Get_CurrentElement().Tag);
ShowMessage('Element: ' + LEADDicomDS1.DefaultInterface.Get_CurrentTag().Name);
//move to next element in the same level of the Data Set
LEADDicomDS1.MoveNextElement(True);
LEADDicomDS1.FindTag (LEADDicomDS1.DefaultInterface.Get_CurrentElement().Tag);
ShowMessage('Element: ' + LEADDicomDS1.DefaultInterface.Get_CurrentTag().Name);
//move to last element in the same level of the Data Set
LEADDicomDS1.MoveLastElement(True);
LEADDicomDS1.FindTag (LEADDicomDS1.DefaultInterface.Get_CurrentElement().Tag);
ShowMessage('Element: ' + LEADDicomDS1.DefaultInterface.Get_CurrentTag().Name);
//move to previous element in the same level of the Data Set
LEADDicomDS1.MovePrevElement(True);
LEADDicomDS1.FindTag (LEADDicomDS1.DefaultInterface.Get_CurrentElement().Tag);
ShowMessage('Element: ' + LEADDicomDS1.DefaultInterface.Get_CurrentTag().Name);
//find the first element that has a child
LEADDicomDS1.EnableMethodErrors:= False;
nRet1:= LEADDicomDS1.MoveFirstElement (False);
while (nRet1 = 0) do
begin
nRet2:= LEADDicomDS1.MoveChildElement;
if(nRet2 = 0)then
begin
LEADDicomDS1.FindTag (LEADDicomDS1.DefaultInterface.Get_CurrentElement().Tag);
ShowMessage('Element: ' + LEADDicomDS1.DefaultInterface.Get_CurrentTag().Name);
nRet1:= 1; //end loop
end;
if(nRet1 <> 1)then
begin
//check next element in this same level
nRet1:= LEADDicomDS1.MoveNextElement(True);
end;
end;
LEADDicomDS1.EnableMethodErrors:= True;
//move back to the element//s parent
if(nRet1 = 1)then
begin
LEADDicomDS1.MoveParentElement();
LEADDicomDS1.FindTag (LEADDicomDS1.DefaultInterface.Get_CurrentElement().Tag);
ShowMessage('Element: ' + LEADDicomDS1.DefaultInterface.Get_CurrentTag().Name);
end;
end;