mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Internal: Tabbing: Tweaks to FocusableItemRegister and using the standard mechanism to allow/block Tab being interpreting by tabbing instead of InputText() widget.
This commit is contained in:
		@@ -3274,7 +3274,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
 | 
			
		||||
    if (g.InputTextState.ID == id)
 | 
			
		||||
        state = &g.InputTextState;
 | 
			
		||||
 | 
			
		||||
    const bool focus_requested = FocusableItemRegister(window, id, (flags & (ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_AllowTabInput)) == 0);    // Using completion callback disable keyboard tabbing
 | 
			
		||||
    const bool focus_requested = FocusableItemRegister(window, id);
 | 
			
		||||
    const bool focus_requested_by_code = focus_requested && (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent);
 | 
			
		||||
    const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
 | 
			
		||||
 | 
			
		||||
@@ -3337,7 +3337,10 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
 | 
			
		||||
        SetActiveID(id, window);
 | 
			
		||||
        SetFocusID(id, window);
 | 
			
		||||
        FocusWindow(window);
 | 
			
		||||
        IM_ASSERT(ImGuiNavInput_COUNT < 32);
 | 
			
		||||
        g.ActiveIdBlockNavInputFlags = (1 << ImGuiNavInput_Cancel);
 | 
			
		||||
        if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput))  // Disable keyboard tabbing out
 | 
			
		||||
            g.ActiveIdBlockNavInputFlags |= (1 << ImGuiNavInput_KeyTab_);
 | 
			
		||||
        if (!is_multiline && !(flags & ImGuiInputTextFlags_CallbackHistory))
 | 
			
		||||
            g.ActiveIdAllowNavDirFlags = ((1 << ImGuiDir_Up) | (1 << ImGuiDir_Down));
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user