DTEDITORINSERT(3)
okay bestie, welcome to the DtEditorInsert(library call) page β the manual name is folded in right here at the top so we can get straight to the group-chat tea π«β¨
πΈ NAME πΈ
DtEditorInsert β insert data into a DtEditor widget. literally the moment you slide new content into the widget at the insertion cursor, no cap π
β¨ SYNOPSIS β¨
okay so you include this and call it like this, fr fr:
#include &<Dt/Editor.h>
DtEditorErrorCode DtEditorInsert(
Widget widget,
DtEditorContentRec *data);
π DESCRIPTION π
so the way that DtEditorInsert works is: it inserts either a string, a wide character string or a sized buffer at the insertion cursor position in a DtEditor widget. itβs giving precision placement, iconic behavior π―β¨
The data is transferred to the DtEditor widget using a DtEditorContentRec, 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. periodt π
widgetβ the DtEditor widget ID. thatβs your main-character widget right there πdataβ a pointer to a data structure containing the data to insert. lowkey straightforward π«Ά
For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3).
For a complete definition of DtEditorContentRec, see Dt/Editor.h - DtEditor(5). iykyk π
π₯ RETURN VALUE π₯
Upon successful completion, the DtEditorInsert function returns one of the following values:
DtEDITOR_NO_ERRORSβ the data was inserted sucessfully. slay βDtEDITOR_NULLS_REMOVEDβNULLcharacters were found and removed from the data. cleanup queen π§Ό
Otherwise, if the DtEditorInsert function cannot insert the data into the DtEditor widget, it returns one of the following values:
DtEDITOR_INVALID_TYPEβ theTypefield is not recognized. π©DtEDITOR_ILLEGAL_SIZEβ the size of the buffer passed in is negative. yeah, negative is not the move πDtEDITOR_NULL_ITEMβ the buffer isNULL. π«DtEDITOR_INSUFFICIENT_MEMORYβ not enough system memory is available to insert the data. π
π¦ EXAMPLES π¦
The following code segment sets the contents of a DtEditor widget to The quick brown fox. β yes bestie, the classic pangram moment π¦β¨
Widget editor;
DtEditorContentRec cr;
DtEditorErrorCode status;
char *sampleString1="The brown fox",
*sampleString2=" quick";
cr.type = DtEDITOR_TEXT;
cr.value.string = sampleString1;
status = DtEditorSetContents(editor, &&cr);
if (status != DtEDITOR_NO_ERRORS &&&& status != DtEDITOR_NULLS_REMOVED) {
printf("Unable to set contents of the widget0);
} 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, &&cr);
if (status != DtEDITOR_NO_ERRORS)
printf("Unable to insert into the contents of the widget0);
}
π APPLICATION USAGE π
If the data is in a disk file, rather than in memory, the application should use DtEditorInsertFromFile(3). thatβs the move per the manual, bestie πΎβ¨
π SEE ALSO π
the whole friend group is here, no cap:
Dt/Editor.h - DtEditor(5)DtEditor(3)DtEditorAppend(3)DtEditorAppendFromFile(3)DtEditorGetContents(3)DtEditorInsertFromFile(3)DtEditorReplace(3)DtEditorReplaceFromFile(3)DtEditorSaveContentsToFile(3)DtEditorSetContents(3)DtEditorGetInsertionPosition(3)DtEditorSetInsertionPosition(3)DtEditorSetContentsFromFile(3)
okay bestie, thatβs the DtEditorInsert(library call) page β the footer has no version or date stamp to spill, just that same library call energy, so this is your cute sign-off: go insert something iconic and be the main character of your widget π
πβ¨
π¦ 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