Disabling User Input

From SIMboxWiki
Jump to: navigation, search

Sometimes a situation arises where it would be convenient to temporarily disable user inputs. For example, if you want the user to enter numbers into a text box using the keypad without having those inputs interpreted as camera movement commands, you would want to do this. Use the following API calls:

• SimApi::InputDevices::enableUserInput(false) – disable user inputs.
• SimApi::InputDevices::enableUserInput(true) – enable user inputs.

Refer to the code sample below, which enables or disables user input depending on whether the edit text box is in focus:

void CPaneDialog::OnEnSetfocusEdit1()
{
   SimApi::InputDevices::enableUserInput(false);
}

void CPaneDialog::OnEnKillfocusEdit1()
{
   SimApi::InputDevices::enableUserInput(true);
}