cancel
Showing results for 
Search instead for 
Did you mean: 

GEsture Event not works

EEuge
Senior

My HPP

#ifndef PRINT_PROGRESS_SCREENVIEW_HPP
#define PRINT_PROGRESS_SCREENVIEW_HPP
 
#include <gui_generated/print_progress_screen_screen/PRINT_PROGRESS_ScreenViewBase.hpp>
#include <gui/print_progress_screen_screen/PRINT_PROGRESS_ScreenPresenter.hpp>
 
class PRINT_PROGRESS_ScreenView : public PRINT_PROGRESS_ScreenViewBase
{
public:
    PRINT_PROGRESS_ScreenView();
    virtual ~PRINT_PROGRESS_ScreenView() {}
    virtual void setupScreen();
    virtual void tearDownScreen();
				
			void handleTickEvent();
			
			virtual void handleClickEvent(const ClickEvent& evt);
			virtual void handleGestureEvent(const GestureEvent& evt); 
			virtual void DRAW_function();
			virtual void ScreenEntered_function();
			
protected:
	Callback<PRINT_PROGRESS_ScreenView, const BoxWithBorder&, const ClickEvent&> Box3DClickedCallback;    
  Callback<PRINT_PROGRESS_ScreenView, const BoxWithBorder&, const GestureEvent&> Box3DGestureCallback;    
 
void Box3DClickHandler(const BoxWithBorder& b, const ClickEvent& e);
void Box3DGestureHandler(const BoxWithBorder& b, const GestureEvent& g);
};
 
#endif // PRINT_PROGRESS_SCREENVIEW_HPP

My CPP

PRINT_PROGRESS_ScreenView::PRINT_PROGRESS_ScreenView():
Box3DClickedCallback(this, &PRINT_PROGRESS_ScreenView::Box3DClickHandler), 
Box3DGestureCallback(this, &PRINT_PROGRESS_ScreenView::Box3DGestureHandler) 	
{
 
}
 
void PRINT_PROGRESS_ScreenView::setupScreen()
{
    PRINT_PROGRESS_ScreenViewBase::setupScreen();
		Box3D.setClickAction(Box3DClickedCallback);
	  
		
		
}
 
void PRINT_PROGRESS_ScreenView::tearDownScreen()
{
    PRINT_PROGRESS_ScreenViewBase::tearDownScreen();
}
 
.....................................
 
void PRINT_PROGRESS_ScreenView::Box3DGestureHandler(const BoxWithBorder& b, const GestureEvent& g_evt)
{
    if (&b == &Box3D)
    {
        //Implement what should happen when 'box' is touched/clicked here.
			if(g_evt.getType() == GestureEvent::SWIPE_VERTICAL)
				{
					
			
 
					
		// Do something with x and y, such as...
					//		presenter->touchRegistered(x, y);   // you write this function in the presenter
				}
   }
}

I try to swipe on Box3D (clickListener is on)

But Box3DGestureHandler - never called....

How to do?

8 REPLIES 8
MM..1
Chief III

There's no any useful information about my problem

try implement this in cpp

virtual void handleGestureEvent(const GestureEvent& evt);

and place breakpoint in.

and maybe add name in hpp

protected:
	touchgfx::Callback<PRINT_PROGRESS_ScreenView, const BoxWithBorder&, const ClickEvent&> Box3DClickedCallback;    
        touchgfx::Callback<PRINT_PROGRESS_ScreenView, const BoxWithBorder&, const GestureEvent&> Box3DGestureCallback;

"virtual void handleGestureEvent(const GestureEvent& evt);"

It's already presents in cpp.

No effect

Look

void PRINT_PROGRESS_ScreenView::handleClickEvent(const ClickEvent& evt)
{
    View::handleClickEvent(evt);
}
 
 void PRINT_PROGRESS_ScreenView::handleGestureEvent(const GestureEvent& evt) 
 { 
 x++;
 }

clickEvent works, gestureEvent not works

EEuge
Senior

This is my cpp

#include 
#include "dsp3D.h"
 
extern DMA2D_HandleTypeDef hdma2d;
 
extern uint32_t tick_counter;
extern uint32_t touch_address;
extern float32_t meshRotation[3];
 
extern uint32_t xx,yyy;
 
 
  extern uint16_t x_from;
	extern uint16_t y_from;
	extern uint16_t x_to;
	extern uint16_t y_to;
	extern uint16_t region_width;
	extern uint16_t region_height;
 
uint32_t adr;
 
uint32_t old_x,old_y,new_x,new_y;
 
uint32_t tft_buffer_number;
uint8_t FRAME_COMPLETE;
 
float32_t dsp3dModel2[218] = {24, 12,
-1, 1, 1, 0, -1, 0,//0
1, 1, 1, 0, -1, 0,
1, 1, -1, 0, -1, 0,
-1, 1, -1, 0, -1, 0,
-1, -1, 1, 0, 1, 0,//4
1, -1, 1, 0, 1, 0,
1, -1, -1, 0, 1, 0,
-1, -1, -1, 0, 1, 0,
1, -1, 1, -1, 0, 0, //8
1, -1, -1, -1, 0, 0,
1, 1, -1, -1, 0, 0,
1, 1, 1, -1, 0, 0,
-1, -1, 1, 1, 0, 0, //12
-1, -1, -1, 1, 0, 0,
-1, 1, -1, 1, 0, 0,
-1, 1, 1, 1, 0, 0,
-1, -1, 1, 0, 0, -1, //16
1, -1, 1, 0, 0, -1,
1, 1, 1, 0, 0, -1,
-1, 1, 1, 0, 0, -1,
-1, -1, -1, 0, 0, 1, //20
1, -1, -1, 0, 0, 1,
1, 1, -1, 0, 0, 1,
-1, 1, -1, 0, 0, 1,
 
0, 1, 2, 255, 0, 0,
3, 0, 2, 255, 0, 0,
6, 5, 4, 255, 0, 0,
6, 4, 7, 255, 0, 0,
8, 9, 10, 0, 255, 0,
11, 8, 10, 255, 255, 0,
14, 13, 12, 255, 0, 0,
14, 12, 15, 255, 0, 0,
16, 17, 18, 255,255,0,
19 ,16, 18, 255, 0,0,
22, 21, 20, 255, 0,0,
22, 20, 23, 255 ,0,0,
};
 
 
PRINT_PROGRESS_ScreenView::PRINT_PROGRESS_ScreenView():
Box3DClickedCallback(this, &PRINT_PROGRESS_ScreenView::Box3DClickHandler), 
Box3DGestureCallback(this, &PRINT_PROGRESS_ScreenView::Box3DGestureHandler) 	
{
 
}
 
void PRINT_PROGRESS_ScreenView::setupScreen()
{
    PRINT_PROGRESS_ScreenViewBase::setupScreen();
		Box3D.setClickAction(Box3DClickedCallback);
	  
		
		
}
 
void PRINT_PROGRESS_ScreenView::tearDownScreen()
{
    PRINT_PROGRESS_ScreenViewBase::tearDownScreen();
}
 
void PRINT_PROGRESS_ScreenView::DRAW_function()
{
 
	
	
		
	
	
	
	if (LTDC_Layer1->CFBAR==0xD0000000) adr=0xD0200000; else adr=0xD0000000;
 
	
	//for(uint16_t x = 502; x CFBAR = (uint32_t)adr;
   
    LTDC->SRCR = (uint32_t)LTDC_SRCR_IMR;
 
 
}	
 
 
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();
						***=x;
						yyy=y;
						touch_address=(yyy*500+***)*4;
				}
					
		// Do something with x and y, such as...
					//		presenter->touchRegistered(x, y);   // you write this function in the presenter
//				}
   }
}
 
 
void PRINT_PROGRESS_ScreenView::Box3DGestureHandler(const BoxWithBorder& b, const GestureEvent& g_evt)
{
    if (&b == &Box3D)
    {
        //Implement what should happen when 'box' is touched/clicked here.
			if(g_evt.getType() == GestureEvent::SWIPE_VERTICAL)
				{
					
					//old_x = d_evt.getOldX();
					//old_y = d_evt.getOldY();
					//new_x = d_evt.getNewX();
					//new_y = d_evt.getNewY();
 
 
					
		// Do something with x and y, such as...
					//		presenter->touchRegistered(x, y);   // you write this function in the presenter
				}
   }
}
 
void PRINT_PROGRESS_ScreenView::handleClickEvent(const ClickEvent& evt)
{
    View::handleClickEvent(evt);
}
 
 void PRINT_PROGRESS_ScreenView::handleGestureEvent(const GestureEvent& evt) 
 { 
xx++;
 }
 
void PRINT_PROGRESS_ScreenView::handleTickEvent()
{
	
	tick_counter++;
 
 
 
		if (tick_counter>300)
		{	
			tick_counter=0;
		}	
 
///Application::getInstance()->registerTimerWidget(this); // ЭТО ЕСЛИ ВДРУГ ПО�?�?ДОБИТСЯ ЛОВИТЬ Т�?КТЫ Т�?ЙМЕР�? В CONTAINER
 
}	
 
 
void PRINT_PROGRESS_ScreenView::ScreenEntered_function()
{
FRAME_COMPLETE=1;
	SCB_CleanInvalidateDCache();
		hdma2d.Init.Mode = DMA2D_M2M;
		hdma2d.Init.OutputOffset =1024-495;
		hdma2d.Init.ColorMode = DMA2D_OUTPUT_RGB888;
		hdma2d.LayerCfg[1].InputOffset = 1024-495;
	  hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB888;	
		//hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
		//hdma2d.LayerCfg[1].InputAlpha = 0;
		HAL_DMA2D_ConfigLayer(&hdma2d, 1);
  	HAL_DMA2D_Init(&hdma2d);
		if(HAL_DMA2D_Start(&hdma2d, LTDC_Layer1->CFBAR+3*(76*1024+502), 0xD0758000,	495, 445) == HAL_OK)
		{
			HAL_DMA2D_PollForTransfer(&hdma2d, 10);
		}
SCB_CleanInvalidateDCache();
}

EEuge
Senior

doesn't anyone know? handleClickEvent and handleGestureEvent are initialized exactly the same way. but Gesture is not called....

try add drag handler

OK, handleDragEvent works, but it called when drag occured in any region of screen. How to connect this handler to one widget, to one boxWithBOrders, for example&