Code Monkey home page Code Monkey logo

Comments (8)

GamingMinds-DanielC avatar GamingMinds-DanielC commented on May 27, 2024 1

There are no collapse buttons in docked windows, not even if you don't disable them. This is a different button that looks different and serves a different function. It belongs to the dock node itself, not to the docked window(s). That's also why there is only one if you dock multiple windows into the same node.

from imgui.

GamingMinds-DanielC avatar GamingMinds-DanielC commented on May 27, 2024 1

Thank you for your answer. So is there a way to remove this button from the dock node? how to initialize that in ImGuiDockNodeFlags?

I never tried this specific one myself, but there should be multiple ways. First you need to include imgui_internal.h to have access to the required flag. Along with that comes the warning that this is not a guaranteed stable API, so use at your own risk. Code based on internals can potentially break with future updates, but if you manage your code well (f.e. wrapping access to internals into a small custom extension library) this shouldn't be a problem.

For the entire dock space:

  • when calling DockSpace() or DockSpaceOverViewport(), include ImGuiDockNodeFlags_NoWindowMenuButton in the flags

Building the dock nodes manually:

  • build your dock space manually with the DockBuilder... functions
  • when using DockBuilderAddNode(), include ImGuiDockNodeFlags_NoWindowMenuButton in its flags

Manipulating the flags of an existing node:

  • retrieve the node you want to manipulate (before splitting it)
  • node->SetLocalFlags(node->LocalFlags | ImGuiDockNodeFlags_NoWindowMenuButton);

By way of the window(s) docked into the node:

  • use SetNextWindowClass() to configure the window you are docking into that node
  • have ImGuiWindowClass::DockNodeFlagsOverrideSet include ImGuiDockNodeFlags_NoWindowMenuButton

from imgui.

AMRD1234 avatar AMRD1234 commented on May 27, 2024

Thank you for your answer.
So is there a way to remove this button from the dock node?
how to initialize that in ImGuiDockNodeFlags to do not create this button?
This is my dock code (copied from demo.cpp):
void Create_DockSpace()
{
static bool opt_fullscreen = true;
static bool opt_padding = false;
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;

// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
if (opt_fullscreen)
{
    const ImGuiViewport* viewport = ImGui::GetMainViewport();
    ImGui::SetNextWindowPos(viewport->WorkPos);
    ImGui::SetNextWindowSize(viewport->WorkSize);
    ImGui::SetNextWindowViewport(viewport->ID);
    ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
    ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
    window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
    window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
}
else
{
    dockspace_flags &= ~ImGuiDockNodeFlags_PassthruCentralNode;
}

// When using ImGuiDockNodeFlags_PassthruCentralNode, DockSpace() will render our background
// and handle the pass-thru hole, so we ask Begin() to not render a background.
if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode)
    window_flags |= ImGuiWindowFlags_NoBackground;

// Important: note that we proceed even if Begin() returns false (aka window is collapsed).
// This is because we want to keep our DockSpace() active. If a DockSpace() is inactive,
// all active windows docked into it will lose their parent and become undocked.
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
if (!opt_padding)
    ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::Begin("DockSpace", NULL, window_flags);
if (!opt_padding)
    ImGui::PopStyleVar();

if (opt_fullscreen)
    ImGui::PopStyleVar(2);

// Submit the DockSpace
ImGuiIO& io = ImGui::GetIO();
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
{
    ImGuiID dockspace_id = ImGui::GetID("Editor DockSpace");
    ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
}
ImGui::End(); }

from imgui.

ocornut avatar ocornut commented on May 27, 2024

By way of the window(s) docked into the node:
use SetNextWindowClass() to configure the window you are docking into that node
have ImGuiWindowClass::DockNodeFlagsOverrideSet include ImGuiDockNodeFlags_NoWindowMenuButton

This is the best and simplest way.

As always the recurrent problem with docking questions is that people want to manipulate a dock node property which is shared by multiple windows, by definition there is a potential conflict, what is 2 windows which have opposite requests are docked together?

from imgui.

AMRD1234 avatar AMRD1234 commented on May 27, 2024

I think I understood it.
Thank you, but apparently my question upset you 'ocornut'...
Sorry, I'm new to IMGUI and confused, but I'm interested in this API...
Maybe my question was ridiculous
Anyway, thanks for your reply

from imgui.

ocornut avatar ocornut commented on May 27, 2024

Sorry I didn't meant to suggest i was upset, but because we answer lots of question I'm not always overly enthusiastic.

Your question is not ridiculous. But there isn't a simple solution that works for all situations, and I guess it is frustrating that we don't have a good answer for it yet.

from imgui.

AMRD1234 avatar AMRD1234 commented on May 27, 2024

No problem. I understand that it is difficult for you to answer all the questions and there is no room for despair. I think IMGUI is the best API for UI and I'm eager to learn it and this little problem can't stop me.
We look forward to further development of IMGUI and your success.

from imgui.

AMRD1234 avatar AMRD1234 commented on May 27, 2024

34
Hi .. it fixes by seting Window menu Button position to none.
Thats so cool.
thank you...!

from imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.