362 views
in GUI Development by
Hello there,

i am trying to use the same slot method for my  WipeTouchHandler's onLeft, onRight etc .

So my current Handler is called handleWipe

Inside handleWipe, i can use trace WipeTouchHandler.Direction and the log window will correctly output Left, Right, Up etc depending on how i wipe.

But how can i use WipeTouchHandler.Direction in an if statement and compare?

if(WipeTouchHandler.Direction == "Left")

will give me an error, presumingly because WipeTouchHandler.Direction isn't just a string and tracert is clever enough to know that but the if statement is not.

How to convert WipeTouchHandler.Direction to a string so i can compare it?

Thank you!

PS: The error i am getting for WipeTouchHandler.Direction == "Left" is :
[19.1.2018 13:59:21] Error Application::Application.mySlot (5:8) : Can not cast from type 'Core::Direction' to type 'string' in the assignment. The both types are not compatible. No automatic conversion possible.

1 Answer

0 votes
by
 
Best answer

Hello,

The "correct" output in your log window is not a string, it is the name of the enum of WipeTouchHandler.Direction (Left, Right, Up etc).

Because, the WipeTouchHandler.Direction is not a string, you cannot compare it directly with a string.
Depending your error, WipeTouchHandler.Direction is of type 'Core::Direction'.
So you can compare like this:
 

if( WipeTouchHandler.Direction == Core::Direction.Left )
 trace "left";


Hope this helps,
greetings,
Chris

by
Yes that did the trick, thank you..

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

...