DTEDITORSETCONTENTS(3)
π NAME π
okay so, bestie, this is DtEditorSetContents from the library call section π
β it places data into a DtEditor widget. No cap, thatβs the whole gig β¨
π SYNOPSIS π
#include &<Dt/Editor.h>
DtEditorErrorCode DtEditorSetContents(
Widget widget,
DtEditorContentRec *data);
π¦ DESCRIPTION π¦
The DtEditorSetContents function places a NULL-terminated string, a wide character string, or a sized buffer into a DtEditor widget. Any data currently in the DtEditor widget is lost. Yep, gone-gone, so vibe-check before you call this one π
The data gets transferred to the DtEditor widget using a DtEditorContentRec, which tells you 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. Cute, right? π
The widget argument specifies the DtEditor widget ID.
The data argument is a pointer to a data structure containing the new contents of widget.
For the full definition of the DtEditor widget and its associated resources, see DtEditor(3).
For the full definition of DtEditorContentRec, see Dt/Editor.h - DtEditor(5).
β οΈ heads up bestie: calling this replaces whatever was already in the widget. The original data is lost. Periodt.
πΈ RETURN VALUE πΈ
Upon successful completion, the DtEditorSetContents function returns one of these little icons:
DtEDITOR_NO_ERRORSβ the data was loaded successfully. slay β¨DtEDITOR_NULLS_REMOVEDβNULLcharacters were found and removed from the data. okay cleanup crew π§Ή
Otherwise, if the DtEditorSetContents function cannot load the data into the DtEditor widget, it returns one of these:
DtEDITOR_INVALID_TYPEβ theTypefield is unrecognized. not the vibe πDtEDITOR_ILLEGAL_SIZEβ the size of the buffer passed in is negative. maβam?? πDtEDITOR_NULL_ITEMβ the buffer isNULL.DtEDITOR_INSUFFICIENT_MEMORYβ not enough system memory is available to load the data. the memory said no π
π EXAMPLES π
The following code segment sets the contents of a DtEditor widget to ``The quick brown fox.'' π¦
Widget editor;
DtEditorContentRec cr;
DtEditorErrorCode status;
char *sampleString="The quick brown fox";
cr.type = DtEDITOR_TEXT;
cr.value.string = sampleString;
status = DtEditorSetContents(editor, &&cr);
if (status != DtEDITOR_NO_ERRORS &&&& status != DtEDITOR_NULLS_REMOVED) {
printf("Unable to set contents of the widget0);
π APPLICATION USAGE π
If the data is in a disk file instead of in memory, the application should use DtEditorSetContentsFromFile(3). iykyk β file data has its own little entrance π
π SEE ALSO π
Dt/Editor.h - DtEditor(5)DtEditor(3)DtEditorAppend(3)DtEditorAppendFromFile(3)DtEditorGetContents(3)DtEditorInsert(3)DtEditorInsertFromFile(3)DtEditorReplace(3)DtEditorReplaceFromFile(3)DtEditorSaveContentsToFile(3)DtEditorSetContentsFromFile(3)
later, bestie π β this page is a library call situation, and the footer has no source/version or date attached, so thatβs the whole cute little sign-off πβ¨
π¦ where this page comes from
- nixos 26.05: cde 2.5.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms