519 views
in GUI Development by
I wonder how I can send the value of a virtual keyboard Dialog to the caller, which in this case is the root object (Application::Application)?

1 Answer

0 votes
by

Hello Michael,

If you have created the keyboard from the provided templates, the keyboard already contains code to feed the application with keyboard events. In other cases, you can feed the events by using the method DriveKeyboardHitting() invoked in context of the root object. This method expects the code representing the pressed key or character and the associated state information: pressed or released.

For example, every time the user touches a key in your virtual keyboard, you can execute following code:

var Core::KeyCode keyCode  = Core::KeyCode.NoKey;
var char          charCode = '\0';

// The user has pressed a special key (not a character key). For example
// the ENTER key:
if ( ... )
  keyCode = Core::KeyCode.Enter;

// The user has pressed character key (e.g. 'A')
if ( ... )
  charCode = 'A';

// Simulate the pressure and release of the affected key
GetRoot().DriveKeyboardHitting( keyCode, charCode, true );
GetRoot().DriveKeyboardHitting( keyCode, charCode, false );

Please note, DriveKeyboardHitting() expects the parameters keyCode and charCode to be provided exclusively. If you provide keyCode then charCode has to be '\0'. If you provide charCode, then keyCode has to be Core::KeyCode.NoKey

Hope it helps you further.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...