Canvas is cool! - page 95

 
Petr Zharuk #:

Is onTimer() in onTimer()? If yes, what Event in milliseconds is set?

I have a multi timer system there:

But typically 30 milliseconds to render an animation.

In this example, there are a total of 6 Canvas objects. 4 objects for menus and two for charts
Most of the graphics output is done without a timer, but at some points it is included.
 
Nikolai Semko #:
Just a demonstration of Canvas capabilities.
Video is not accelerated, everything works without lags.
OpenCL and DirectX were not used.
If you use OpenCL, the processor will not be loaded at all.
But even with the use of a simple processor the time of formation of one frame is on average 5 -15 milliseconds.


.
Very beautiful
 
Nikolai Semko #:
I have a multi timer system there:

But typically 30 milliseconds to render an animation.

This example has a total of 6 Canvas objects. 4 objects for menus and two for charts
Most of the graphics output is done without a timer, but at some points it is included.

How do I overcome Canvas render freezing when I rewind the chart using the mouse-click method? Mine doesn't render until I release the mouse.

 
Petr Zharuk #:

How to overcome freezing of Canvas rendering when rewinding the chart by mouse-clicking? I don't get it to render until I release the mouse.

This is a problem with the choice of event for redrawing Canvas.
When scrolling the main chart, you can use two events CHARTEVENT_CHART_CHANGE or CHARTEVENT_MOUSE_MOVE (if the mouse button is pressed).
For example, look at this example.
If we are talking about MT4, you may need to use a timer for redrawing, and in OnChartEvent() set only permissive bool marks. Because in MT4 there is a glitch in the event model that leads to lags.
In general, it would be good to accompany your questions about problems with minimal code that reproduces these problems. There would be no need to make guesses and assumptions.

 
Nikolai Semko #:

These are problems with the choice of event for redrawing Canvas.
When scrolling the main chart, you can use two events CHARTEVENT_CHART_CHANGE or CHARTEVENT_MOUSE_MOVE (if the mouse button is pressed).
For example, see this example.
If we are talking about MT4, you may need to use a timer for redrawing, and in OnChartEvent() set only permissive bool marks. Because in MT4 there is a glitch in the event model that leads to lags.
In general, it would be good to accompany your questions about problems with minimal code that reproduces these problems. There would be no need to make guesses and assumptions.

Working with events helped to solve my problem.

Thank you!

 

Is there anyway to use CCanvas and OBJ_BUTTON together?

I created a CCanvas that is the width and height of the entire screen. I set the background to false for the canvas (I added a function to Canvas.mqh for that). 

I have another indicator that is loaded on the chart that has buttons to change symbols. But the button clicks are not getting processed. Do I have to make sure the location of the canvas doesn't interfere with the location of the buttons?

Thanks,

Elliot 

 
E Kwestel #:

But the button clicks are not processed. Should I make sure that the layout of the canvas does not interfere with the layout of the buttons?

OBJPROP_ZORDER

Приоритет графического объекта на получение события нажатия мышки на графике (CHARTEVENT_CLICK).
По умолчанию при создании значение выставляется равным нулю, но при необходимости можно повысить приоритет.
При наложении объектов друг на друга событие CHARTEVENT_CLICK получит только один объект, чей приоритет выше остальных.
 
trader6_1 #:
Спасибо!