Disabling a function when cursor is in input text box?

For my application, I want the hotkeys to go offline when the user clicks is using the input text box.

I tried using an if conditional so that the hotkeys stop working when the mouse is in the proximity of the textbox, but I think it would be better to have the function disabled when the user is typing in the textbox.

I tried using

inputbox.onSetFocus = function() {
enable = true;
}
inputbox.onKillFocus = function() {
enable = false;
}

What should I be using?