429 views
in GUI Development by

Hi,

Our application allows a user to edit numerical values using rotary knobs to make the adjustment.

Touching and releasing the readout component places the component in the edit mode in which the value displayed responds to rotary knob input.
As shown here, the Current limit for Ch 2 is in the edit mode.


In order to prevent conflicts with other components on the screen, while an edit is occurring, we make the readout component modal during the edit.

Currently to exit the edit mode, the user must press and release the readout component being edited.

If the user wishes to edit the Ch 3 Current, I would like to make it possible for them to simpy touch the Ch 3 Current readout and have the Ch 2 readout exit the edit mode and the Ch 3 readout enter the edit mode. 

I implemented Paul's suggestion of overriding the Application.DriveCursorHitting function to detect a keypress outside of the readout control's bounds to initiate an exit from the edit mode. This works fine except the user must repeat the touch in order to achieve the desired action.


Is it possible to repeat the screen touch programatically to avoid the necessity to repeat the screen touch?

Thanks,

Joe

1 Answer

0 votes
by

Hello Joe,

your adaptation of the DriveCursorHitting() method is executed before the actual touch event is delivered to a new target. This means, if your code ends the modal state of Ch 2 component, the framework should be able to deliver afterwards the current event to another (e.g. Ch 3) component. What does the assignment readout.OutsideTouch = true do? Does it terminate the modal state immediately? Or is there any delay caused e.g. by an animation effect or postsignal/idlesignal? Avoid the delay. Following code demonstrates the approach:

var ProjectComponents::Readout readout = ...

if (( readout != null ) && ( readout.Bounds != aPos ))
  EndModal( readOut );

return super( aDown, aFinger, aPos );

Does it solve the problem?

Regarding your concrete question how to repeat a screen touch programmatically, you can in fact invoke the methods DriveCursorHitting() directly from the GUI application. So you simulate press/release touch events. With DriveCursorMovement() you can simulate drag events.

Best regards

Paul Banach

by
Hi Paul,

Thanks for the speedy reply. I believe you are correct on the delay issue.
Placing the EndModal ( readout ); call in the overridden DriveCursorHitting() method passe the touch event through like you said.

One question remains though.

If I want to call DriveCursorHitting() from the GUI application, how do I prefix it?

Application::Application.DriveCursorHitting(true,0,Application::Device.OutsideTouchPoint);
 Results in the following error:

[12.8.2019  8:23:26] Error ProjectComponents::Readout.ExitRotaryEdit (81:26) : Unexpected type expression 'Application::Application' left to the method call 'DriveCursorHitting()'. Instead of the type a value expression is expected.
 

Thanks,

Joe Lupfer
by

Hello Joe,

the method is invoked in scope of the application object (the root object). How you get access to the root object is described here. For example:

GetRoot().DriveCursorHitting( ... );

Best regards

Paul Banach

by
Thanks again Paul,

Our project now responds to touch events the way we want it to.

Best Regards,

Joe Lufer

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

...