DTEDITORSETCONTENTS(3)

πŸ“¦
version 2.5.3 Β· 2 versions
, in nixos 26.05

πŸ’– 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 β€” NULL characters 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 β€” the Type field is unrecognized. not the vibe πŸ™ˆ
  • DtEDITOR_ILLEGAL_SIZE β€” the size of the buffer passed in is negative. ma’am?? πŸ’€
  • DtEDITOR_NULL_ITEM β€” the buffer is NULL.
  • 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 πŸ‘‘


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