sx_GetMemo

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_GetMemo

VB Declaration

Declare Function sx_GetMemo Lib "Apollo9.dll"

(ByVal cpFieldName As String,

ByVal uiLineWidth As Integer)

As String

C Declaration

LONG FAR PASCAL sx_GetMemo

(BYTEP cpFieldName,

USHORT uiLineWidth);

Description

Extracts the contents of a memo (M) or weakly-typed VariField (V) field as a string and optionally format the memo with hard carriage returns and line feeds for printing.

Note: Many of the sx_Get* functions can be replaced with a single call to sx_GetVariant. The sx_Get* functions that return specific data types are primarily for C programmers who cannot use sx_GetVariant.

Parameters

cpFieldName: The name of the field.

uiLineWidth: The width of a formatted line that will be terminated with a carriage return-line feed (to the nearest word boundary). If uiLineWidth is zero, no formatting is performed. Pass uiLineWidth 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 or VariField contents is returned as a string. An empty memo or VariField is returned as a NULL string (0&).

VB Example

Sub Brw1_Change (nRowCol As Integer)

' whenever rec no changes, dynamically

' display memo and other detail data

If nRowCol <> BRW_CHANGE_COL Then

If sx_Empty("notes") Then

tMemo.Text = ""

Else

tMemo.Text = sx_GetMemo("notes", 0)

End If

tLast.Text = sx_GetTrimString("last")

tCity.Text = sx_GetTrimString("city")

End If

End Sub

C Example

BYTEP cpMemo;

 

cpMemo = (BYTEP) sx_GetMemo("notes", 0);

SetWindowText(hwnd, (LPSTR) cpMemo);

 

// memo now in edit space so de-allocate

if (lstrlen(cpMemo))

sx_MemDealloc(cpMemo);

 

// Note: do not use the result of this function as direct input

// into other functions because there will be no way

// to de-allocate the memory. ALWAYS use an intermediate

// BYTEP to store the result and then use sx_MemDealloc

// to release the memory when you are done with it.

See Also

sx_Replace