<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods > GetMemo |
Declaration
function GetMemo( sFieldName: String; iLineWidth: Integer): PChar;
Description
Extracts the contents of a memo (M) field as a PChar and optionally format the memo with hard carriage returns and line feeds for printing.
Parameters
sFieldName: The name of the field.
iLineWidth: The width of a formatted line that will be terminated with a carriage return-line feed (to the nearest word boundary). If iLineWidth is zero, no formatting is performed. Pass iLineWidth as zero if displaying the memo contents in a multiline text box. Windows will automatically perform word wrap within a multiline control. Note that existing hard coded carriage return-line feed pairs are left intact.
Return Value
The a reference to the memo contents is returned as a PChar. An empty memo is returned as a NULL string ('' or #0).
WARNING: When you are finished with the memo, you must deallocate the string space with MemDealloc unless the string length is 0 (NULL) in which case you must not deallocate the memory. Do not use any other memory management function (from the Windows API or Delphi's FreeMem procedure) to free the memory.
Delphi Example
procedure Form1.Button1Click(Sender: TObject);
var
cpMemoText: PChar;
begin
if ApTbl.Empty( 'NOTES' ) then
Memo1.Text := ''
else
begin
cpMemoText := ApTbl.GetMemo( 'NOTES', 0 );
Memo1.SetTextBuf( cpMemoText );
ApTbl.MemDealloc( cpMemoText );
end;
Edit1.Text := ApTbl.GetTrimString( 'LAST' );
Edit2.Text := ApTbl.GetTrimString( 'CITY' );
end;
See Also