Comments (8)
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.
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()
orDockSpaceOverViewport()
, includeImGuiDockNodeFlags_NoWindowMenuButton
in the flags
Building the dock nodes manually:
- build your dock space manually with the
DockBuilder...
functions - when using
DockBuilderAddNode()
, includeImGuiDockNodeFlags_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
includeImGuiDockNodeFlags_NoWindowMenuButton
from imgui.
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.
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.
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.
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.
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.
Hi .. it fixes by seting Window menu Button position to none.
Thats so cool.
thank you...!
from imgui.
Related Issues (20)
- Add RGFW backend implementation HOT 2
- Text wrapping: how does it work? HOT 1
- ImDrawList rects aren't perfect HOT 7
- Running ImGui app on Arm Processor (Allwinner H3 with mali 400 -> orangepi one) HOT 1
- Can no longer use ctrl shortcuts in InputText's as of v1.90.6 HOT 4
- ImGui::BeginTooltip() should allow specifying override HOT 4
- No Hover Flags in ImGui::IsAnyItemHovered() HOT 4
- Keeping combo open after clicking selectable
- Stretch table to window scrollable size
- TitleBarRect does not contain FramePadding. This will cause the window to not move correctly after ConfigWindowsMoveFromTitleBarOnly is enabled.
- Small window flickering when move out the edge of main window. HOT 5
- Can't select only 1 input when inputs are slightly close to each other HOT 12
- Unresolved external symbol, all ImGui CPP Files are included HOT 3
- Jumping the user to a different part of the GUI HOT 3
- Mouse resize child window HOT 1
- Changing hIcon and hIconSm are not changing to custom icon HOT 1
- io.WantCaptureMouse doesn't work for scrollwheel HOT 3
- How to use ImGui rounding style for ImGui::MenuItems? HOT 2
- Scale to window maintaining aspect ratio, but Viewport won't center HOT 2
- Please help me to clarify the concepts of some specific terms HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui.