hello, please help about ccanvas, why it does reset all my globals variables.... ? :((

To add comments, please log in or register
boobyditbeber
112
boobyditbeber  

Hello,


I have a serious problem with ccanvas

If I use mycanvas.Destroy() in OnDeinit() it will reset all my globals variables.

If I don't use it I will keep all in same place but I loose all information about my canvas ofcourse. It must be created a new time by OnInit with a new object because it delete the object too. 

So very strange how ccanvas works. all is right, but I don't know why my global variables are modified ??

I hope you will understand what I speak about because it not so easy to explain it.


If an guru know how to keep my globals variables  without change.....

Thanks 

Ps: you can test it in mt4 or mt5 is you change in .mq5

luaunch the indicator as usually. now click one time on the object (top left) release the button and drag as you want . click a new time and your object will stay a that place. etc...

compare between those 2 guys. so if you change the color with Destroy() the object will always go back to the top left of the screen. reset the position. not what I want.

Without Destroy() the object stay at the same place if I change the color, BUT the COLOR DOES nOT change...


laurent

boobyditbeber
112
boobyditbeber  
boobyditbeber:

Hello,


I have a serious problem with ccanvas

If I use mycanvas.Destroy() in OnDeinit() it will reset all my globals variables.

If I don't use it I will keep all in same place but I loose all information about my canvas ofcourse. It must be created a new time by OnInit with a new object because it delete the object too. 

So very strange how ccanvas works. all is right, but I don't know why my global variables are modified ??

I hope you will understand what I speak about because it not so easy to explain it.


If an guru know how to keep my globals variables  without change.....

Thanks 

Ps: you can test it in mt4 or mt5 is you change in .mq5

luaunch the indicator as usually. now click one time on the object (top left) release the button and drag as you want . click a new time and your object will stay a that place. etc...

compare between those 2 guys. so if you change the color with Destroy() the object will always go back to the top left of the screen. reset the position. not what I want.

Without Destroy() the object stay at the same place if I change the color, BUT the COLOR DOES nOT change...


laurent

Hello,


I found a nice way to keep the x and y positions. All informations after the OnDeinit() are lost and Ccanvas free by itself or OnDeinit() the memory allocation done by :  myObject01.CreateBitmapLabel(.....)

So the way is to copy the x and y position into another LabelObject that is not a Ccanvas Object :))))

The problem was the Ccanvas object didn"t keep the x and y position when I changed the timeframe. 

NOW it is RIGHT.

As always keep the way to find a trick when you program, and the light will be after some hard work and test. never fall down, your mind always will win the game :))

you will find the file to compare it. use it if you want in your program ... you will need to clean a bit , but it works so .


Soon it will be a clock with transparency level, color and a full of possibilities..

A countdown timer is on the way too.

i will give a try for the end of january a think... bye

Laurent

 thanks for your patience :))

the file is here, so click on the square , realese the button , move the mouse , click a new time , etc ...

transparency and color can be changed

It is a test, improvement must be , the cos and sin are sync with the timer but it is not the right way, the next update will be with the local computer time with reminder. so the line will move as smoth as possible. :))

If you like and want to use it in prog do it but claen a bit the code, it is very durty.


Good luk


Laurent

Files:
Zee Zhou Ma
1901
Zee Zhou Ma  
So, do you need any help? :D
boobyditbeber
112
boobyditbeber  
Zee Zhou Ma:
So, do you need any help? :D

Hi,


Thanks about your help :)

It is so special how the onInit() and onDeint() work, sometime it reset global variable and sometime not. It depends what we do with the software:

REASON_PROGRAM

0

Expert Advisor terminated its operation by calling the ExpertRemove() function

REASON_REMOVE

1

Program has been deleted from the chart

REASON_RECOMPILE

2

Program has been recompiled

REASON_CHARTCHANGE

3

Symbol or chart period has been changed

REASON_CHARTCLOSE

4

Chart has been closed

REASON_PARAMETERS

5

Input parameters have been changed by a user

REASON_ACCOUNT

6

Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings

REASON_TEMPLATE

7

A new template has been applied

REASON_INITFAILED

8

This value means that OnInit() handler has returned a nonzero value

REASON_CLOSE

9

Terminal has been closed


I think it doesn't follow exactly the tab we can find in the notice.

I did try some of those and I don't get what I can read. I need to test each of them to know what exactly it will do in OnInt() & OnDeint(). It is not clear at all.

Did you have test them ?


Bye


Laurent


boobyditbeber
112
boobyditbeber  

Hi 

an update about ccanvas clock.

now it is synchro with the local time computer

the move is more smooth and you can move it without stop the clock, not so easy because only one thread in mt4 for that indicator and that chart

but it works well, soon I will draw all number and others niddles.

Try it please and tell me if it works for you.

you can change the transparency 0-255 for the niddle and background

the rotation

color 

voila :)))


Laurent

Files:
To add comments, please log in or register