Giter VIP home page Giter VIP logo

Comments (6)

ocornut avatar ocornut commented on June 26, 2024 1

You can use an InvisibleButton() just before calling EndChild() and use this. Make sure the button covers entire child region. You can call ImGui::DebugDrawItemRect() after InvisibleButton() to ensure your geometry is correct.

from imgui.

ocornut avatar ocornut commented on June 26, 2024

It doesn't indeed, but I'm not sure we can make it work as it would be a relatively ambiguous behavior.
What's inside your child? Do you want the drag to happen when clicking and interacting with any item within the child?

You might submit an invisible button covering the child window as the last item in the window, and use as a drop source. Have you tried that? (not same problem, but similar idea as what's used in #3379)

from imgui.

BraunSilas avatar BraunSilas commented on June 26, 2024

interesting post(#3379). Here is a picture

Git Issue screeshot

Each of the blocks on saying "Wait" are movement commands for a robot. Each of those commands has multiple inputs and so on and I want to be able to reorder them by dragging them on top or inbetween of each other.

To reflect on your response...

I can put a button within the child on the lowest z level just above the child (cause I need to be able to reach the widgets in the child. Is that right?
I am gonna give it a shot.

from imgui.

BraunSilas avatar BraunSilas commented on June 26, 2024
git 3

I did that and you can see the red rectangle;
The Problem I have is:
I have a child for the left gray bar on each of the routines and a child with all of the other elements in it.(see image)
the structure of the code is somthng like this:

BeginChild(); //LeftGrayBar
EndChild();
BeginChild(); //with all other elements
EndChild();
InvisibleButton();

The button is only reachable in the gaps between the 2 children.
It seems like the children have a higher z value.
the same is the case if I but the Button before the children.

I solved it now by putting the invisible button in all of the children, so it will be active on all layers.
not pretty but it works.

from imgui.

ocornut avatar ocornut commented on June 26, 2024

You can add the undocumented ImGuiButtonFlags_FlattenChildren to InvisibleButton() to solve this.

However, I think your nested use of BeginChild() is unnecessary and may be inefficient. Child windows are meant to be scrolling area.

Instead of

BeginChild(); //LeftGrayBar
EndChild();
BeginChild(); //with all other elements
EndChild();
InvisibleButton();

You can use:

BeginGroup(); //LeftGrayBar
//..
EndGroup();
SameLine();
BeginGroup(); //with all other elements
EndGroup();
InvisibleButton();

BeginGroup() will lock the X coordinates. You can also use Indent() to adjust it.

from imgui.

BraunSilas avatar BraunSilas commented on June 26, 2024

Good to know, thank you.
I am gonna run with the hacked Solution for now to save time refactoring the layout but I'll use it from now on.
Thanks @ocornut
Cheers

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.