Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
всю отрисовку, привязанную к барам или времени, осуществляю в одной функции, например void Draw()
в OnChartEvent добавляю строку , отслеживая событие изменение чарта (новый бар - это так же событие изменение чарта)
в OnCalculate для режима теста добавляю строку для перерисовки например при наступлении нового бара, т.к. OnChartEvent не работает:
Если это не работает в MT4, значит что-то не так с событием CHARTEVENT_CHART_CHANGE. Сейчас не проверить, пока нет котировок.
Николай, чтобы Вы не тратили время я выше написал решение, которое решило мою проблему, а именно, как Вы верно заметили, следующий код вставленный в OnCalcucate():
Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
I didn't get it, do you need to move the rectangular area inside the entire canvas?
Николай, чтобы Вы не тратили время я выше написал решение, которое решило мою проблему, а именно, как Вы верно заметили, следующий код вставленный в OnCalcucate():
В обычном нетестовом режиме так делать не надо, т.к. функция ChartChanged() будет выполняться два раза подряд, что не разумно. Ведь она выполняется при наступлении события CHARTEVENT_CHART_CHANGE внутри файла iCanvas.mqh. Правильно перерисовку вашего канваса, привязанного к барам или времени осуществлять в OnChartEvent при наступлении события изменения окна ( CHARTEVENT_CHART_CHANGE) без использования ChartChanged().
Николай, чтобы Вы не тратили время я выше написал решение, которое решило мою проблему, а именно, как Вы верно заметили, следующий код вставленный в OnCalcucate():
Нужно принимать следующее во внимание:
ChartChanged() выполняется каждый раз при наступлении события CHARTEVENT_CHART_CHANGE в OnChartEvent внутри класса iCanvas
Сначала выполняется функция OnChartEvent внутри класса iCanvas, а потом OnChartEvent вашего кода.
Ваша проблема была из-за того, что OnCalculate выполняется по-видимому до выполнения OnChartEvent и поэтому ChartChanged() еще не отрабатывалась. Поэтому целесообразно обработчик перерисовки осуществлять именно в OnChartEvent, а не в OnCalculate. Тем более это надо делать потому, что пользователь может изменить размеры окна в любой момент времени. За это все отвечает событие CHARTEVENT_CHART_CHANGE
I didn't get it, do you need to move the rectangular area inside the entire canvas?
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
The CCanvas is simply a x/y Array of points.
I mean a function which moves the m_pixels to the left, right, up, down.
Да, вполне обоснованное желание. Тем более не сложно его реализовать. Я об этом думал, но пришел к выводу, что если есть потребность к передвижению прямоюгольной части общего канваса, то существует более простой способ реализовать это:
Создать новый канвас меньшего размера. В этом случае не надо беспокоиться о заполнении фона передвигаемой части.
Yes, a well-founded desire.
Moreover, it is not difficult to implement it.
I thought about it, but came to the conclusion that if there is a need to move the rectangular part of the common canvas, then there is an easier way to implement it:
Create a new, smaller canvas. In this case, you don't have to worry about filling the background of the moving part.
Да, вполне обоснованное желание. Тем более не сложно его реализовать. Я об этом думал, но пришел к выводу, что если есть потребность к передвижению прямоюгольной части общего канваса, то существует более простой способ реализовать это:
Создать новый канвас меньшего размера. В этом случае не надо беспокоиться о заполнении фона передвигаемой части.
Yes, a well-founded desire.
Moreover, it is not difficult to implement it.
I thought about it, but came to the conclusion that if there is a need to move the rectangular part of the common canvas, then there is an easier way to implement it:
Create a new, smaller canvas. In this case, you don't have to worry about filling the background of the moving part.
That's not working because my Canvas is the fullscreen. It's like a tick chart but it cost too much time to erase the complete background and construcht and paint everything new so I need to move the content to the left (eg. 8 pixels) and draw only the new 8 pixels (8 px in x direction and full height) with new data. I tried to move the Canvas 8 px to the left with MoveCanvas and this is working but I can't resize it the way that from the left 8 px width are removed and on the right 8 px are added. I hope you understand...
Это касается обычного режима или тестера?
Обычный режим, Николай.
Thank you!
Is this function not suitable?
Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
Обычный режим, Николай.
Я обычно поступаю по следующей схеме:
Если это не работает в MT4, значит что-то не так с событием CHARTEVENT_CHART_CHANGE. Сейчас не проверить, пока нет котировок.
Я обычно поступаю по следующей схеме:
Если это не работает в MT4, значит что-то не так с событием CHARTEVENT_CHART_CHANGE. Сейчас не проверить, пока нет котировок.
Николай, чтобы Вы не тратили время я выше написал решение, которое решило мою проблему, а именно, как Вы верно заметили, следующий код вставленный в OnCalcucate():
Unfortunately not. It moves the bitmap object itself, I need a function that moves the content x points. I know that internally the memory consists of an x, y array but there is no memmove or something in mql. I don't know how to move the memory quickly.
I didn't get it, do you need to move the rectangular area inside the entire canvas?
Николай, чтобы Вы не тратили время я выше написал решение, которое решило мою проблему, а именно, как Вы верно заметили, следующий код вставленный в OnCalcucate():
В обычном нетестовом режиме так делать не надо, т.к. функция ChartChanged() будет выполняться два раза подряд, что не разумно. Ведь она выполняется при наступлении события CHARTEVENT_CHART_CHANGE внутри файла iCanvas.mqh.
Правильно перерисовку вашего канваса, привязанного к барам или времени осуществлять в OnChartEvent при наступлении события изменения окна ( CHARTEVENT_CHART_CHANGE) без использования ChartChanged().
Николай, чтобы Вы не тратили время я выше написал решение, которое решило мою проблему, а именно, как Вы верно заметили, следующий код вставленный в OnCalcucate():
Нужно принимать следующее во внимание:
Ваша проблема была из-за того, что OnCalculate выполняется по-видимому до выполнения OnChartEvent и поэтому ChartChanged() еще не отрабатывалась.
Поэтому целесообразно обработчик перерисовки осуществлять именно в OnChartEvent, а не в OnCalculate. Тем более это надо делать потому, что пользователь может изменить размеры окна в любой момент времени. За это все отвечает событие CHARTEVENT_CHART_CHANGE
I didn't get it, do you need to move the rectangular area inside the entire canvas?
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
The CCanvas is simply a x/y Array of points.
I mean a function which moves the m_pixels to the left, right, up, down.
Yes. Example: I draw a circle in the middle of the full screen canvas and want to move the circle to the left, but I don't want to delete the entire area and repaint the circle with every movement, but simply scroll the memory to the left.
The CCanvas is simply a x/y Array of points.
I mean a function which moves the m_pixels to the left, right, up, down.
Да, вполне обоснованное желание.
Тем более не сложно его реализовать.
Я об этом думал, но пришел к выводу, что если есть потребность к передвижению прямоюгольной части общего канваса, то существует более простой способ реализовать это:
Да, вполне обоснованное желание.
Тем более не сложно его реализовать.
Я об этом думал, но пришел к выводу, что если есть потребность к передвижению прямоюгольной части общего канваса, то существует более простой способ реализовать это:
That's not working because my Canvas is the fullscreen. It's like a tick chart but it cost too much time to erase the complete background and construcht and paint everything new so I need to move the content to the left (eg. 8 pixels) and draw only the new 8 pixels (8 px in x direction and full height) with new data. I tried to move the Canvas 8 px to the left with MoveCanvas and this is working but I can't resize it the way that from the left 8 px width are removed and on the right 8 px are added. I hope you understand...