cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get click coordinates continuously?

EEuge
Senior

Hello!

I want to click on the touch screen, get the coordinates, then, without releasing my finger, move my finger and get new coordinates continuously.

Like slider widget)

How do I do this?

This code

void PRINT_PROGRESS_ScreenView::Box3DClickHandler(const BoxWithBorder& b, const ClickEvent& evt)
{
    if (&b == &Box3D)
    {
        //Implement what should happen when 'box' is touched/clicked here.
		//	if(evt.getType() == ClickEvent::PRESSED)
			//	{
					
					int x = evt.getX();
					int y = evt.getY();
						
					
					
		// Do something with x and y, such as...
					//		presenter->touchRegistered(x, y);   // you write this function in the presenter
//				}
   }
}

gives coordinates only twice time - at pressing and at releasing ....

3 REPLIES 3
Romain DIELEMAN
ST Employee

Hi,

I believe the dragEvent could be something to look for in your case, since you continuously get new XY data. It is used as well by the slider widget. Otherwise you could just also use the tickEvent to get the coordinates of the clickEvent every few ticks instead of just at the first touch.

/Romain

Hm... I tried to use DragEvent.... But This type of event not appeared. I thought, that drag event is only for dragable widgets. But my widgets is not moveable.

Cab you give me sample of code?

Decision with tickEvent is better for me. Tell me, how can I read current X, Y without detecting event?

"se the tickEvent to get the coordinates of the clickEvent every few ticks instead of just at the first touch."

How to?

Give me a sample of code, please...