Skip to content
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

How to save and restore a check box state between runs. #7374

Closed
nikitablack opened this issue Mar 7, 2024 · 3 comments
Closed

How to save and restore a check box state between runs. #7374

nikitablack opened this issue Mar 7, 2024 · 3 comments
Labels
settings .ini persistance

Comments

@nikitablack
Copy link

nikitablack commented Mar 7, 2024

Version/Branch of Dear ImGui:

Version 1.90, Branch: docking

Back-ends:

custom

Compiler, OS:

Ubuntu 20.04

My Issue/Question:

I have searched for similar questions and although people were asking, there's no official solution. The 437 issue looks promising - here @ocornut mentions that some hooks are now possible and exposed. What are these hooks and how to use them? I saw the ImGuiSettingsHandler struct in imgui_internal.h and I suspect these are the hooks Omar mentioned. But again, how to use them to save a check box state, or, say, a text box text?

@ocornut
Copy link
Owner

ocornut commented Mar 7, 2024

The general idea of the library is that you own the state exposed to the UI and it is your responsibility to save it on your own.

@nikitablack
Copy link
Author

Sure. The beauty of the library is that it does a single thing and does it good!
But still, I'd like to reuse the functionality that's already in the library and would kindly request a sample usage of ImGuiSettingsHandler to save and retrieve a custom state, if it's possible at all.

@ocornut ocornut added the settings .ini persistance label Mar 7, 2024
@ocornut
Copy link
Owner

ocornut commented Mar 7, 2024

The library uses it so if you search for ImGuiSettingsHandler you'll want examples, as well as here:
#2564 (comment)

You're not reusing much by using ImGuiSettingsHandler i'm honestly not sure it is worth it.

@ocornut ocornut closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
settings .ini persistance
Projects
None yet
Development

No branches or pull requests

2 participants