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

Copy/paste menu in all text inputs #4686

Open
dbr opened this issue Nov 1, 2021 · 3 comments
Open

Copy/paste menu in all text inputs #4686

dbr opened this issue Nov 1, 2021 · 3 comments

Comments

@dbr
Copy link

dbr commented Nov 1, 2021

Version/Branch of Dear ImGui:

Version: 1.84.2

My Issue/Question:
In short, I'm looking to emulate something like this menu:
image
so if a user right-clicks in any text (or numeric) input, they can select copy, or paste, etc and it'll do exactly the same as the ctrl+c/etc shortcuts which are already working

I can do this along these lines
https://github.com/ocornut/imgui/blob/v1.85/imgui_demo.cpp#L3261-L3279
however that seems to involve calling BeginPopupContextItem after every text-input which is a bit infeasible

I'm certain this has been asked before, but after a bunch of searching I couldn't find anything

Thanks!

@rokups
Copy link
Contributor

rokups commented Nov 1, 2021

If you need a menu - you must implement a menu. If you are looking for some kind of uniform behavior it is best to make a widget wrapper function which calls said widget and implements menu you need.

@ocornut
Copy link
Owner

ocornut commented Nov 1, 2021 via email

@ocornut
Copy link
Owner

ocornut commented Nov 1, 2021

Also linking to #1844 which is a different issue but relate to same thing. Specifically for #1844 we would need to be able to forward specific events (such as copy/paste, undo) from an external source to have them processed by the InputText(). If we can make that happen, then creating that menu in user-land is possible, and likely it would become possible to provide that stock menu (with an opt-in flag) as well as a function to emit the menu as part of a user custom menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants