@ -66,7 +66,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- input text: expose CursorPos in char filter event (#816)
- input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active.
- input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701)
- input text: way to dynamically grow the buffer without forcing the user to initially allocate for worse case, e.g. more natural std::string (follow up on #200)
- input text: hover tooltip could show unclamped text
- input text: option to Tab after an Enter validation.
IM_ASSERT(!((flags&ImGuiInputTextFlags_CallbackHistory)&&(flags&ImGuiInputTextFlags_Multiline)));// Can't use both together (they both use up/down keys)
IM_ASSERT(!((flags&ImGuiInputTextFlags_CallbackCompletion)&&(flags&ImGuiInputTextFlags_AllowTabInput)));// Can't use both together (they both use tab key)
ImGuiInputTextFlags_CallbackCompletion=1<<6,// Call user function on pressing TAB (for completion handling)
ImGuiInputTextFlags_CallbackHistory=1<<7,// Call user function on pressing Up/Down arrows (for history handling)
ImGuiInputTextFlags_CallbackAlways=1<<8,// Call user function every time. User code may query cursor position, modify text buffer.
ImGuiInputTextFlags_CallbackCharFilter=1<<9,// Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.
ImGuiInputTextFlags_CallbackCharFilter=1<<9,// Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 in callback to discard character.
ImGuiInputTextFlags_AllowTabInput=1<<10,// Pressing TAB input a '\t' character into the text field
ImGuiInputTextFlags_CtrlEnterForNewLine=1<<11,// In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).
ImGuiInputTextFlags_NoHorizontalScroll=1<<12,// Disable following the cursor horizontally
@ -652,6 +652,7 @@ enum ImGuiInputTextFlags_
ImGuiInputTextFlags_Password=1<<15,// Password mode, display all characters as '*'
ImGuiInputTextFlags_NoUndoRedo=1<<16,// Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
ImGuiInputTextFlags_CallbackResize=1<<18,// Allow buffer capacity resize + notify when the string wants to be resized (for string types which hold a cache of their Size)
// [Internal]
ImGuiInputTextFlags_Multiline=1<<20// For internal use by InputTextMultiline()
};
@ -1415,27 +1416,30 @@ struct ImGuiStorage
};
// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used and the corresponding callback is triggered.
// The callback function should return 0 by default.
// Special processing:
// - ImGuiInputTextFlags_CallbackCharFilter: return 1 if the character is not allowed. You may also set 'EventChar=0' as any character replacement are allowed.
// - ImGuiInputTextFlags_CallbackResize: BufTextLen is set to the new desired string length so you can allocate or update known size. No need to initialize new characters or zero-terminator as InputText will do it.
structImGuiTextEditCallbackData
{
ImGuiInputTextFlagsEventFlag;// One of ImGuiInputTextFlags_Callback* // Read-only
ImGuiInputTextFlagsEventFlag;// One ImGuiInputTextFlags_Callback* // Read-only
ImGuiInputTextFlagsFlags;// What user passed to InputText() // Read-only
void*UserData;// What user passed to InputText() // Read-only
// CharFilter event:
ImWcharEventChar;// Character input // Read-write (replace character or set to zero)
// Completion,History,Always events:
// If you modify the buffer contents make sure you update 'BufTextLen' and set 'BufDirty' to true.
char*Buf;// Current text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer!
intBufTextLen;// Current text length in bytes // Read-write // [Resize,Completion,History,Always]