cancel
Showing results for 
Search instead for 
Did you mean: 

Graph clicklistener

MPast.1
Senior II

Hi all,

I need to read the coordinates from screen when user touch a DynamicGraph.

So I enabled the clicklistener mixin and inserted in the code the handleClickEvent(ClickEvent& event), but no events is recognized.

What must I do to received the events?

If I insert a breakpoint and touch the graph, this never trigger.

4 REPLIES 4
Romain DIELEMAN
ST Employee

Hi,

definitely not the best approach but if you just need to know when the user touches the dynamic graph you could always just add an empty "container" widget, which you will enable the ClickListener option. Is this enough for your GUI ? If not could you maybe share your project ?

/Romain

MPast.1
Senior II

Hi Romain,

I added a custom Container over a graph and I enabled ClickListener on the custom Container. Obviously the custom container has the same size as the chart box

0693W000008zr8MQAQ.pngBut not events are generated.

I have void Screen_CronoView::handleClickEvent(ClickEvent& evt) routine and

virtual void handleClickEvent(ClickEvent& evt) prototype.

I'm sorry but I don't understand what i'm wronging or what I'm missing.

Do you have some hints?

thanks

GPa.1
Associate III

Hi!

In the interactions, enable the clickEvent for graph, it is already integrated in the graph widget.

 0693W00000AMKtPQAX.pngThen in your function take the coordinates from the event.

Regards!

HI @GPa.1,

I tryed your solution and it partially work because every click is recognized individually by the trigger event. In this way I need to press the finger over the graph a lot of times. The scope is to redraw the graph moving your finger over the screen.

I was looking for something like as MOVEMENT event, that must be different from drag event.

In other words the system must engaged the trigger evertyme I move the finger over the graph and provide to me with the new X and Y coordinates.

The solution I found is catching data from

 bool STM32TouchController::sampleTouch(int32_t& x, int32_t& y)

end every 100ms in the

handleTickEvent()

a simply routine check what are the values readed by the touch system and filter the action only if those coordinates are inside the graph border.

It work but I would like to find a more elegant solution using graph & system events.

Do you have some other idea?