-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flag to prevent window move unless dragging title bar #899
Comments
There isn't at the moment (#823), will look at that. Adding the flag also seems sensible. |
Keep in mind that you'll also need code to make sure the title bar remains visible at all times in this case, otherwise you can be stuck with a window you can't reposition because the title bar is off-screen. |
I had this come up and was able to wrie a quick implementation, if you're still interested in this flag, what should it be called? I added it as "ImGuiWindowFlags_TitleMove" immediately after ImGuiWindowFlags_NoMove. I could issue a PR if poeple are still interested. |
Hello, The main reason for stalling has been that I don't want to exhaust flags :) The other reason for stalling this is that the sort of flag I suspect interested users would want to pass everytime to So:
Please add new flag at the bottom of the public list to minimize issues with people who have duplicated flags in their language bindings. We can re-order the flags occasionally but there's no need to do it every time. ( |
The issue for me is, and correct me if I'm misunderstanding something, but if I have a widget that is an image for example, but is actually a render target, I would like the person to be able to click and possibly drag from inside that RT. The problem of course is that any left click actions that drag move the entire window. I don't see any way to stop this as most widgets in the demo have this behavior, but if I'm incorrect in that assumption and can disable dragging for specific widgets that would be useful. (Or to put it better, consume window events when a specific widget is hovered over) |
@dmitsuki The way I got around this as suggested in one of the other issues is by using an ImageButton:
|
Literally any interactive widget will prevent window from being moved. What is your code doing? Image() won't be enough as it's not an interactive widget. |
"Literally any interactive widget will prevent window from being moved. What is your code doing?" I don't think it's a code thing, I think I just erroneously assumed graph widgets were interactive because they highlight current elements, but I was wrong. All buttons and the like work properly, and the solution works as well. Sorry for the confusion. |
This is a good point, "interactive" is not the term, |
you can make a child window that takes up pretty much the entire main window, save for the title bar, and enable the nomove flag on the child. |
I've been forced to use range4life's hack fix for my custom widget to work right. |
@Wizzard033 how does your custom widget works? There’s no eg InvisibleButton based interaction? Please provide as much context as possible, because I don’t think the OP request is the right solution for that widget issue discussed above. |
I'm drawing an image and supporting click+drag interaction on it. My main reason for not liking this solution is that I now have extra padding around my widget. Additionally, I don't like this form of window movement in the first place. |
Thanks for the explanation, makes sense. I think we could move this to
I'm flagging this for an upcoming release 1.61~1.62. |
That sounds great, thanks! |
…y window with no title bars (often popups). This affects clamping window within the visible area: with this option enabled title bars need to be visible. (#899) Tweaked default value of style.DisplayWindowPadding from (20,20) to (19,19) so the default style as a value which is the same as the title bar height.
This feature was added yesterday as a global toggle |
Question to everyone using Right now I ignored the flag on windows that have no title bar, so e.g. popups would still be moveable. Do you have any opinion on that? I was hesitant because I'm worried it would remove that little bit of flexibility that could be useful in some situations (e.g. misplaced popups). For example I personally like to be able to move the color picker popup sometimes. And in many situation the programmer can still use It would however definitively feel more consistent. I'm not a user of So most likely I am going to make that change now but any feedback/opinion are welcome... And maybe I should aim to allow for another form of interaction to move windows. (Bonus: I should mention that it is possible to move windows with the navigation system, currently holding CTRL+Tab then using Arrows or Shift+Arrows allows you to move and resize windows. I assume this is not well known! This was designed for the Gamepad controls and I left it for keyboard because I should it was convenient and not harmful.) |
As someone using I'm glad to know there is keyboard shortcuts to move things, but I'm skeptical about adding new interactions to move windows. I feel that it'd be potentially intrusive to some of peoples' many widget interactions they already have created. As far as I know, the only ways to move a window on Windows are to (1) click+drag title bar (2) use keyboard shortcut windowskey+arrows while window is selected or (3) right click the window in the task bar and select move. |
I think requiring the popup to have a title bar if you wish to be able to move it is fine and Windows works itself IIRC. |
Can the color picker popup be forced to have a title bar? |
The |
Is it too much bloat then to have optional BeginPopup(flags.ForceDragable) then, so movement is opt in? |
Currently window drawn by
ImGui::Begin()
will move when dragged by any empty area. Occasional accidental clicks very often mess up my ui by moving windows about.Is there an easy way to find out if title is hovered apart from checking mouse coordinates and distance to the top of the window?
Or add a flag such as:
ImGuiWindowFlags_MoveOnlyByTitleDrag
?The text was updated successfully, but these errors were encountered: