question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hiding close button on windows

See original GitHub issue

ImGui supports hiding the close button on BeginWindow by passing in a null pointer to the p_opened value. I made the following change to support this in the .NET bindings but it would break the existing API if anyone is using it and not sure if thats something you would want a PR on.

It looks like some of the native structs don’t have real wrappings to them (especially the window struct). There is some functionality I need and was thinking about implementing them.

Also some of the lower level imgui functions are missing from the cimgui library like the XYZBehavior methods creating a lot of hacks to get around this with setting positions and using invisible buttons.

ImGui.cs

        public unsafe static bool BeginWindow(string windowTitle, ref bool? opened, WindowFlags flags)
        {
            byte value = (opened.HasValue && opened.Value) ? (byte)1 : (byte)0;
            byte* p_opened = opened.HasValue ? &value : null;

            var result = ImGuiNative.igBegin(windowTitle, p_opened, flags);

            if (opened.HasValue)
                 opened = value == 1;

            
            return result;

        }

ImGuiNative.cs

        public static extern bool igBegin(string name, byte* p_opened, WindowFlags flags);

Edit: Corrected the code to use p_opened instead of the result of the call.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
ghostcommented, Apr 28, 2018

@mellinoe You are a legend my friend.

Works great. Thank you so much 😃

0reactions
mellinoecommented, Apr 28, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Hide Close Button of Any Application in Windows 10
To hide 'Close' button for the active window, press “Ctrl+1” hotkey. This will immediately remove the Close button for that window. When you ......
Read more >
5 Ways to Restore the Title Bar, Minimize, Maximize, and ...
5 Ways to Restore the Title Bar, Minimize, Maximize, and Close Buttons in Windows 10 · 1. Check the App's Settings · 2....
Read more >
How can I hide/remove/delete windows Caption Buttons ...
I'm trying to get tired of hiding or removing the title bar and buttons for minimizer, maximize and close. I did a lot...
Read more >
FIX: Minimize/Maximize/Close Buttons Missing [Chrome, ...
1. Restart Desktop Window Manager · Press Ctrl + Shift + Esc to start Task Manager. · When Task Manager opens, locate Desktop...
Read more >
How to disable and enable window close button [X] in ...
I need to disable and enable the Windows [X] close button using the Binding (Mvvm). How can I do ? Best Regards.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found