824 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...