<!-- $XConsortium: EdSetCon.sgm /main/6 1996/09/08 20:03:55 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.MAN40.rsml.1">]]>
<![ %CDE.C.XO; [<RefEntry Id="XCSA.MAN40.rsml.1">]]>
<RefMeta>
<RefEntryTitle>DtEditorSetContents</RefEntryTitle>
<ManVolNum>library call</ManVolNum>
</RefMeta>
<RefNameDiv>
<RefName><Function>DtEditorSetContents</Function></RefName>
<RefPurpose>place 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>DtEditorSetContents</Function></FuncDef>
<ParamDef>Widget <Parameter>widget</Parameter></ParamDef>
<ParamDef>DtEditorContentRec *<Parameter>data</Parameter></ParamDef>
</FuncSynopsis>
</RefSynopsisDiv>
<RefSect1>
<Title>DESCRIPTION</Title>
<Para>The
<Function>DtEditorSetContents</Function> function places a
<SystemItem Class="Constant">NULL</SystemItem>&minus;terminated string, wide character string
or sized buffer into a DtEditor widget.
Any data currently in the DtEditor widget is lost.
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 placed into the DtEditor widget, the insertion cursor is
positioned at the first character.
</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 new contents of
<Symbol Role="Variable">widget</Symbol>. <![ %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>DtEditorSetContents</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>DtEditorSetContents</Function> function returns one of the following values:
</Para>
<VariableList>
<VarListEntry>
<Term>DtEDITOR_NO_ERRORS</Term>
<ListItem>
<Para>The data was loaded 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>DtEditorSetContents</Function> function
cannot load the data in the DtEditor widget,
it returns one of the following values:
</Para>
]]>
<VariableList>
<VarListEntry>
<Term>DtEDITOR_INVALID_TYPE</Term>
<ListItem>
<Para>The Type field is unrecognized.
</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 load 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                    *sampleString="The quick brown fox";
cr.type = DtEDITOR_TEXT;
cr.value.string = sampleString;
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");
</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.DtEditorSetContentsFromFile;.</Para>
</RefSect1>
<RefSect1>
<Title>SEE ALSO</Title>
<Para>&cdeman.Dt.Editor.h;, &cdeman.DtEditor;, &cdeman.DtEditorAppend;, &cdeman.DtEditorAppendFromFile;, &cdeman.DtEditorGetContents;, &cdeman.DtEditorInsert;, &cdeman.DtEditorInsertFromFile;, &cdeman.DtEditorReplace;, &cdeman.DtEditorReplaceFromFile;, &cdeman.DtEditorSaveContentsToFile;, &cdeman.DtEditorSetContentsFromFile;.</Para>
</RefSect1>
</RefEntry>
<!--fickle 1.12 mancsf-to-docbook 1.2 08/07/95 23:40:24-->
