700 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 - 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

...