GetStringValue Example for Delphi
procedure TForm1.TestProc7();
var
nCount: Integer;
x: Integer;
nRet: Integer;
begin
LEADDicomDS1.EnableMethodErrors:= False;
//move to the root element
LEADDicomDS1.MoveFirstElement (False);
LEADDicomDS1.MoveRootElement ();
//insert a new element for the String Values
LEADDicomDS1.InsertElement (False, TAG_IMAGE_TYPE, VR_CS, False, 0);
//insert some string values into the element
LEADDicomDS1.StringValueCount:= 5;
for x:= 0 to 5 - 1 do
LEADDicomDS1.StringValues [x]:= 'String #' + IntToStr(x + 1);
//set the strings
nRet:= LEADDicomDS1.SetStringValue(5);
if(nRet <> 0)then
begin
ShowMessage('Error');
Exit;
end;
LEADDicomDS1.StringValueCount:= 0; //free the values
Edit5.Visible:= True;
Edit5.Text:= '';
//get the value count
nCount:= LEADDicomDS1.GetValueCount ();
ShowMessage('There are ' + IntToStr(nCount) + ' values!');
//get the values
nRet:= LEADDicomDS1.GetStringValue (0, nCount);;
if(nRet = 0)then
begin
for x:= 0 to LEADDicomDS1.StringValueCount - 1 do
//display each value separated on a separate line
Edit5.Text:= Edit5.Text + Chr(13) + Chr(10) + LEADDicomDS1.StringValues [x];
end;
LEADDicomDS1.EnableMethodErrors:= True;
ShowMessage('wait');
end;