
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Debug the add function.
Add(tbt) is working. Showing button is connected with the panel.
I'm facing a similar issue.. Did you ever come up with a solution?
I'm facing a similar issue.. Did you ever come up with a solution?
Add this
m_button.Z_Order(100);
into Controls\Button.mqh file
Hi,
I'm facing a similar issue. I create all of my controls like this:
So as you can see, each and every of these buttons have the ZOrder property of 100, but the unique properties differ (name, id, etc). I have 15 buttons on my graphical panel, 8 of them does not behave as expected (yap, that's a 50%+ ratio, with the very same properties!).
If I click a button with no object behind it, this happens:
A properly working button looks like this:
A malfunctioning button creates these events:
But if there is an other object behind it the following happens:
Proper button:
malfunctioning button:
The object in the background is a VLINE.
In both background object cases, the event handler received information that I was clicked an object (the VLINE), and the button sparam went to the CHARTEVENT_CUSTOM (there is no EventChartCustom() used in the code), which shows the object text in case of a properly working button, and ClientBack in case of a malfunctioning button.
When I hover the mouse over a properly working button, I can see its Object Name as sparam:
But when I do the same for any of the malfunctioning buttons, I do not see anything! The event handler does not notice if anything have happened, so I think something goes wrong during the object creation, the object does not get the sparam properly. This error persists through restarts, recompiles, etc.
Think this might be the case of the original error in the topic, because if you see @Somsri Sarkar showed pics of some ClientBack sparams.
What's going wrong with these controls?
Hello,
Sorry, seems the thread does not come up on the feed, so sorry for pinging you guys directly, @amando, @Marco vd Heijden and @Denny Muhammad Zein.
With the more detailed problem explanation, could you please look into it, where could our code go wrong? We'd really appreciate your help.Properly working button event handler call:
Malfunctioning button eventhandler call:
So as you can see nothing unusual here, even the eventhandler call is the same.
Thank you in advance,
J.
One more interesting detail:
If I check the Object properties on the chart, I see nothing unusual on the properly created button:
BUT for the button that is not properly visible to the event handler:
What is that? Where does it get that value from? It is identical for all the malfunctioning buttons.
I tried to set the x1,y1,x2,y2 coords explicitly without any calculations, thought that might cause the issue, but it didn't work.
Finally I got it. This last bit of info helped. The sparam is passed improperly because of the confusion around the height parameter. I checked how I pass values to the Create function, and if I used
so when y1 > y2 (therefore height is calculated in a reverse manner) the height calculation gets messed up, a nonsense value will be generated as height, and sparam will be set as ClientBack.
But as soon as I changed it back to a x1 < x2; y1 < y2 format like this:
all of the sudden it got cured.
@Somsri Sarkar check your button.Create statement if it is the case for you.