Skip to content

Introduce stopOnCtrlC in application.#816

Closed
gizahNL wants to merge 1 commit intorivo:masterfrom
gizahNL:control_c_event_passage
Closed

Introduce stopOnCtrlC in application.#816
gizahNL wants to merge 1 commit intorivo:masterfrom
gizahNL:control_c_event_passage

Conversation

@gizahNL
Copy link
Copy Markdown

@gizahNL gizahNL commented Feb 23, 2023

This allows consuming applications signal that they intend to keep running when control+c is pressed, and instead want the event to be handled by their primitives.

My use case is for a window in which I run shell commands; And that I want to cancel via pressing control+c. The current default of stopping on control+c is kept so there should not be any surprises for anyone updating.

This allows consuming applications signal that they intend to keep
running when control+c is pressed, and instead want the event to be
handled by their primitives.
@rivo
Copy link
Copy Markdown
Owner

rivo commented Feb 23, 2023

This is what Application.SetInputCapture() is for. This specific use case is actually documented there. You can also use it to bind "Close Application" to a different key.

@rivo rivo closed this Feb 23, 2023
@gizahNL
Copy link
Copy Markdown
Author

gizahNL commented Feb 24, 2023

This is what Application.SetInputCapture() is for. This specific use case is actually documented there. You can also use it to bind "Close Application" to a different key.

Can you perchance explain how to do it that way? I am able to block handling of control+c that way completely, but I don't see a way to let control+c be passed down chain without the application getting stopped.

@rivo
Copy link
Copy Markdown
Owner

rivo commented Feb 26, 2023

Actually, your question made me realize that there was indeed no way to forward Ctrl-C to primites. You were able to block it or translate it but not forward.

I fixed this now. There is now a specific way to achieve this. Check out the link above for details.

@gizahNL
Copy link
Copy Markdown
Author

gizahNL commented Feb 27, 2023

Actually, your question made me realize that there was indeed no way to forward Ctrl-C to primites. You were able to block it or translate it but not forward.

I fixed this now. There is now a specific way to achieve this. Check out the link above for details.

Many thanks! That will work for me !

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants