<!-- $XConsortium: EdInsert.sgm /main/6 1996/09/08 20:03:30 rws $ -->
<!-- (c) Copyright 1995 Digital Equipment Corporation. -->
<!-- (c) Copyright 1995 Hewlett-Packard Company. -->
<!-- (c) Copyright 1995 International Business Machines Corp. -->
<!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
<!-- (c) Copyright 1995 Novell, Inc. -->
<!-- (c) Copyright 1995 FUJITSU LIMITED. -->
<!-- (c) Copyright 1995 Hitachi. -->

<![ %CDE.C.CDE; [<RefEntry Id="CDEMX.XCSA.MAN30.rsml.1">]]>
<![ %CDE.C.XO; [<RefEntry Id="XCSA.MAN30.rsml.1">]]>
<RefMeta>
<RefEntryTitle>DtEditorInsert</RefEntryTitle>
<ManVolNum>library call</ManVolNum>
</RefMeta>
<RefNameDiv>
<RefName><Function>DtEditorInsert</Function></RefName>
<RefPurpose>insert data into a DtEditor widget
</RefPurpose>
</RefNameDiv>
<!-- CDE Common Source Format, Version 1.0.0-->
<!-- *************************************************************************-->
<!-- **  (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company-->
<!-- **  (c) Copyright 1993, 1994, 1995 International Business Machines Corp.-->
<!-- **  (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.-->
<!-- **  (c) Copyright 1993, 1994, 1995 Novell, Inc.-->
<!-- *************************************************************************-->
<RefSynopsisDiv>
<FuncSynopsis Remap="ANSI">
<FuncSynopsisInfo>#include &lt;Dt/Editor.h>
</FuncSynopsisInfo>
<FuncDef>DtEditorErrorCode <Function>DtEditorInsert</Function></FuncDef>
<ParamDef>Widget <Parameter>widget</Parameter></ParamDef>
<ParamDef>DtEditorContentRec *<Parameter>data</Parameter></ParamDef>
</FuncSynopsis>
</RefSynopsisDiv>
<RefSect1>
<Title>DESCRIPTION</Title>
<Para>The
<Function>DtEditorInsert</Function> function inserts either a string, wide character string or sized buffer
at the insertion cursor position in a DtEditor widget.
The data is transferred to the
DtEditor widget using a
<StructName Role="typedef">DtEditorContentRec</StructName>, which indicates the
type of data being transferred along with the actual data.
After the data is appended, the insertion cursor is positioned after the
last character inserted.
</Para>
<Para>The
<Symbol Role="Variable">widget</Symbol> argument specifies the DtEditor widget ID.
</Para>
<Para>The
<Symbol Role="Variable">data</Symbol> argument is a pointer to a data structure
containing the data to insert.
<![ %CDE.C.CDE; [</Para>
<Para>For a complete definition of the DtEditor widget
and its associated resources, see
&cdeman.DtEditor;. ]]></Para>
<Para>For a complete definition of
<StructName Role="typedef">DtEditorContentRec</StructName>, see
&cdeman.Dt.Editor.h;.</Para>
</RefSect1>
<RefSect1>
<Title>RETURN VALUE</Title>
<![ %CDE.C.XO; [
<Para>Upon successful completion, the
<Function>DtEditorInsert</Function> function returns
<SystemItem Class="Constant">DtEDITOR_NO_ERRORS</SystemItem>; otherwise, it returns one of the following values:
</Para>
]]>
<![ %CDE.C.CDE; [
<Para>Upon successful completion, the
<Function>DtEditorInsert</Function> function returns one of the following values:
</Para>
<VariableList>
<VarListEntry>
<Term>DtEDITOR_NO_ERRORS</Term>
<ListItem>
<Para>The data was inserted sucessfully.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term>DtEDITOR_NULLS_REMOVED</Term>
<ListItem>
<Para>NULL characters were found and removed from the data.
</Para>
</ListItem>
</VarListEntry>
</VariableList>
<Para>Otherwise, if
the
<Function>DtEditorInsert</Function> function
cannot insert the data into the DtEditor widget,
it returns one of the following values:
</Para>
]]>
<VariableList>
<VarListEntry>
<Term>DtEDITOR_INVALID_TYPE</Term>
<ListItem>
<Para>The Type field is not recognized.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term>DtEDITOR_ILLEGAL_SIZE</Term>
<ListItem>
<Para>The size of the buffer passed in is negative.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term>DtEDITOR_NULL_ITEM</Term>
<ListItem>
<Para>The buffer is
<SystemItem Class="Constant">NULL</SystemItem>. <![ %CDE.C.CDE; [</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term>DtEDITOR_INSUFFICIENT_MEMORY</Term>
<ListItem>
<Para>Not enough system memory is available to insert the data.
]]></Para>
</ListItem>
</VarListEntry>
</VariableList>
</RefSect1>
<RefSect1>
<Title>EXAMPLES</Title>
<Para>The following code segment sets the contents of a DtEditor
widget to ``The quick brown fox.''
</Para>
<InformalExample Remap="indent">
<ProgramListing>Widget                  editor;
DtEditorContentRec      cr;
DtEditorErrorCode       status;
char                    *sampleString1="The brown fox",
                        *sampleString2=" quick";
cr.type = DtEDITOR_TEXT;
cr.value.string = sampleString1;
status = DtEditorSetContents(editor, &amp;cr);
<![ %CDE.C.XO; [if (status != DtEDITOR_NO_ERRORS) {
]]><![ %CDE.C.CDE; [if (status != DtEDITOR_NO_ERRORS &amp;&amp; status != DtEDITOR_NULLS_REMOVED) {
]]>        printf("Unable to set contents of the widget&bsol;n");
} else {
  /*
   * Move the insertion cursor so it is after the
   * letter 'e' in "The".
   */
        DtEditorSetInsertionCursorPosition(editor, 2);
        cr.type = DtEDITOR_TEXT;
        cr.data.string = sampleString2;
        status = DtEditorInsert(editor, &amp;cr);
        if (status != DtEDITOR_NO_ERRORS)
          printf("Unable to insert into the contents of the widget&bsol;n");
}
</ProgramListing>
</InformalExample>
</RefSect1>
<RefSect1>
<Title>APPLICATION USAGE</Title>
<Para>If the data is in a disk file, rather than in memory, the application should
use
&cdeman.DtEditorInsertFromFile;.</Para>
</RefSect1>
<RefSect1>
<Title>SEE ALSO</Title>
<Para>&cdeman.Dt.Editor.h;, &cdeman.DtEditor;, &cdeman.DtEditorAppend;, &cdeman.DtEditorAppendFromFile;, &cdeman.DtEditorGetContents;, &cdeman.DtEditorInsertFromFile;, &cdeman.DtEditorReplace;, &cdeman.DtEditorReplaceFromFile;, &cdeman.DtEditorSaveContentsToFile;, &cdeman.DtEditorSetContents;, &cdeman.DtEditorGetInsertionPosition;, &cdeman.DtEditorSetInsertionPosition;, &cdeman.DtEditorSetContentsFromFile;.</Para>
</RefSect1>
</RefEntry>
<!--fickle 1.12 mancsf-to-docbook 1.2 08/07/95 23:40:24-->
