//+------------------------------------------------------------------+ //| Delete the button | //+------------------------------------------------------------------+ bool ButtonDelete(const long chart_ID=0, // chart's ID const string name="Button") // button name { //--- reset the error value ResetLastError(); //--- delete the button if(!ObjectDelete(chart_ID,name)) { Print(__FUNCTION__, ": failed to delete the button! Error code = ",GetLastError()); return(false); } //--- successful execution return(true); } //+------------------------------------------------------------------+ //| Delete the button | //+------------------------------------------------------------------+
use this function ??
i think you can code it to move button to out of chart ( change X Distance and Y Distance ).
button move is only move it.
but i want button minimize to minimize it.
button move is only move it.
but i want button minimize to minimize it.
Either:
- Delete close buy and close sell, then recreate them when the minimize button is clicked again
- Hide close buy and close sell by changing their OBJPROP_TIMEFRAMES to OBJ_NO_PERIODS, then show them with OBJ_ALL_PERIODS when the minimize button is clicked again
You will need a way of knowing if close buy and close sell are minimized or not. You can either:
- Have a global-scope variable or a static variable to act as a flag
- Check if close buy and close sell exist (or are visible)
- Check OBJPROP_STATE of the minimize button
Either:
- Delete close buy and close sell, then recreate them when the minimize button is clicked again
- Hide close buy and close sell by changing their OBJPROP_TIMEFRAMES to OBJ_NO_PERIODS, then show them with OBJ_ALL_PERIODS when the minimize button is clicked again
You will need a way of knowing if close buy and close sell are minimized or not. You can either:
- Have a global-scope variable or a static variable to act as a flag
- Check if close buy and close sell exist (or are visible)
- Check OBJPROP_STATE of the minimize button
(( then recreate them when the minimize button is clicked again))
how to do this ?
//+------------------------------------------------------------------+ //+- Button Minimize ------------------------------------------------+ if (id == CHARTEVENT_OBJECT_CLICK) { if (sparam == "ButtonMinimize") { //+--- ObjectDelete(0, "ButtonCloseBuy"); ObjectDelete(0, "ButtonCloseSell"); //+--- } ObjectSetInteger(0,"ButtonMinimize",OBJPROP_STATE,false); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+
this is what i done so far.
forextime8: how to do this ?
| How to do what? You already know how to create the buttons. Just remember the current state. On click, if created, delete them and state is deleted, otherwise create them and state is created. |
How to do what? You already know how to create the buttons. Just remember the current state. On click, if created, delete them and state is deleted, otherwise create them and state is created. |
still failure to recreate on the second click....
Please see the articles https://www.mql5.com/en/articles and look for the ones on graphical interfaces.
Please see the articles https://www.mql5.com/en/articles and look for the ones on graphical interfaces.
i had just bookmarked those pages,
but i cant found the Graphical Interfaces X: (Build 1) pages.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i just created an easy 3 button,
1, button close buy
2, button close sell
3, and the new button, button minimize
on the pic, the top right button is button minimize,
when click it, the button close buy / sell, i want it to minimize,
and click the 2nd time, it will show it again.
so what the function should i use for button minimize ?
should i use objectdelete function for this button ?
thanks for the help.