|
009-imGui窗口中的多行文本框InputTextMultiline
郁金香灬外挂技术
https://www.yjxsoft.com/
本教程视频1920*1080分辩率下观看最佳
VS2017+win10 64位 环境
郁金香老师:扣扣 150330575
欢迎大家参加 郁金香灬技术 游戏安全与外挂的研究学习。
兴趣是我们最好的老师
成长需要过程与循序渐进
兴趣+坚持+时间+优秀的课教程会帮助你快速成功
学习目标:
多行文本框InputTextMultiline
文本框的回调函数
IMGUI_API bool
InputText(
const char* label, //UI名字,不会被显示 相当于人的身份证 以区别不同的UI对象
char* buf, // 显示内容缓冲区 保存文本的变化
size_t buf_size, //显示内容缓冲区大小
//以下可用默认值
ImGuiInputTextFlags flags = 0,
ImGuiInputTextCallback callback = NULL,
void* user_data = NULL);
IMGUI_API bool
InputTextMultiline(
const char* label, //UI名字,不会被显示 相当于人的身份证 以区别不同的UI对象
char* buf,
size_t buf_size,
//以下可用默认值
const ImVec2& size = ImVec2(0, 0), //UI宽度 高度
ImGuiInputTextFlags flags = 0, //显示标志位
ImGuiInputTextCallback callback = NULL, //回调函数
void* user_data = NULL); //用户数组
// Callback function for ImGui::InputText()
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data);
// int callback(ImGuiInputTextCallbackData* data);
// ImGuiInputTextFlags
enum ImGuiInputTextFlags_
{
ImGuiInputTextFlags_None = 0,
ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/
ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef
ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z
ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs
ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus
ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to every time the value was modified). Consider looking at the IsItemDeactivatedAfterEdit() function.
ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Callback on pressing TAB (for completion handling)
ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Callback on pressing Up/Down arrows (for history handling)
ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Callback on each iteration. User code may query cursor position, modify text buffer.
ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.
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
ImGuiInputTextFlags_AlwaysOverwrite = 1 << 13, // Overwrite mode 覆盖模式
ImGuiInputTextFlags_ReadOnly = 1 << 14, // Read-only mode 只读模式
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_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input)
ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this)
ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active)
ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert)
// Obsolete names
//ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior
};
static int testEditCallback(ImGuiInputTextCallbackData* data)
{
printf("data->EventChar=%d buf=%s EventKey=%d EventFlag=%d\r\n",
data->EventChar,
data->Buf,
data->EventKey,
data->EventFlag
);
if (data->EventChar >='a'&& data->EventChar <= 'c')
{
return 1; //过滤 屏蔽掉输入
}
else
{
return 0;
}
}
void CDX11::多行文本输入框()
|
|