OBJ_EDIT_Example

Author: Copyright 2019, MetaQuotes Software Corp.
0 Views
0 Downloads
0 Favorites
OBJ_EDIT_Example
ÿþ//+------------------------------------------------------------------+

//|                                             OBJ_EDIT_Example.mq5 |

//|                        Copyright 2013, MetaQuotes Software Corp. |

//|                                              http://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright   "Copyright 2019, MetaQuotes Software Corp."

#property link        "http://www.mql5.com"

#property version     "1.00"

#property description "The Expert Advisor creates and controls the OBJ_EDIT object"

#property strict

//+------------------------------------------------------------------+

//| "8?K :=>?>:                                                      |

//+------------------------------------------------------------------+

enum ENUM_BUTTON_TYPE

  {

   ALIGN_BUTTON=1,

   CORNER_BUTTON=2,

   COORD_BUTTON=3

  };

//--- 2E>4=K5 ?0@0<5B@K 

input string           InpName="OBJ_Edit_1";        // <O >1J5:B0

input int              InpX=150;                    //  0AAB>O=85 ?> >A8 X

input int              InpY=250;                    //  0AAB>O=85 ?> >A8 Y

input string           InpText="Text";              // "5:AB >1J5:B0

input string           InpFont="Arial";             // (@8DB

input int              InpFontSize=14;              //  07<5@ H@8DB0

input ENUM_ALIGN_MODE  InpAlign=ALIGN_CENTER;       // !?>A>1 2K@02=820=8O B5:AB0

input bool             InpReadOnly=false;           // >7<>6=>ABL @540:B8@>20BL

input ENUM_BASE_CORNER InpCorner=CORNER_LEFT_UPPER; // #3>; 3@0D8:0 4;O ?@82O7:8

input color            InpColor=clrNavy;            // &25B B5:AB0

input color            InpBackColor=clrIvory;       // &25B D>=0

input color            InpBorderColor=clrOrangeRed; // &25B 3@0=8FK

input bool             InpBack=false;               // 1J5:B =0 704=5< ?;0=5

input bool             InpSelection=false;          // K45;8BL 4;O ?5@5<5I5=89

input bool             InpHidden=false;             // !:@KB 2 A?8A:5 >1J5:B>2

input long             InpZOrder=0;                 // @8>@8B5B =0 =060B85 <KHLN

//---

#include <ChartObjects\ChartObjectsTxtControls.mqh>

//--- :=>?:0 ReadOnly

CChartObjectButton ExtReadOnlyButton;

//--- :=>?:0 Selectable

CChartObjectButton ExtSelectableButton;

//--- :=>?:8 C?@02;5=8O A?>A>1>< 2K@02=820=8O

CChartObjectButton ExtAlignLButton;

CChartObjectButton ExtAlignCButton;

CChartObjectButton ExtAlignRButton;

//--- :=>?:8 C?@02;5=8O C3;>< ?@82O7:8

CChartObjectButton ExtCornerLUButton;

CChartObjectButton ExtCornerLLButton;

CChartObjectButton ExtCornerRUButton;

CChartObjectButton ExtCornerRLButton;

//--- :=>?:8 +- 4;O :>>@48=0B x 8 y

CChartObjectButton ExtCoordIncXButton;

CChartObjectButton ExtCoordDecXButton;

CChartObjectButton ExtCoordIncYButton;

CChartObjectButton ExtCoordDecYButton;

//--- 8=D>@<0F8>==K5 ?>;O

CChartObjectEdit ExtXCoordinateInfo;

CChartObjectEdit ExtYCoordinateInfo;

CChartObjectEdit ExtCornerInfo;

CChartObjectEdit ExtAlignInfo;

CChartObjectEdit ExtReadOnlyInfo;

CChartObjectEdit ExtSelectableInfo;

//---

bool ExtInitialized=false;

long ExtChartWidth=0;

long ExtChartHeight=0;

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//--- >?@545;8< @07<5@K >:=0

   if(!ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0,ExtChartWidth))

     {

      Print("5 C40;>AL ?>;CG8BL H8@8=C 3@0D8:0! >4 >H81:8 = ",GetLastError());

      return(INIT_FAILED);

     }

   if(!ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0,ExtChartHeight))

     {

      Print("5 C40;>AL ?>;CG8BL 2KA>BC 3@0D8:0! >4 >H81:8 = ",GetLastError());

      return(INIT_FAILED);

     }

//--- A>74048< >1J5:B OBJ_EDIT =0 3@0D8:5      

   if(!EditCreate(0,InpName,0,InpX,InpY,250,20,InpText,InpFont,InpFontSize,InpAlign,InpReadOnly,

      InpCorner,InpColor,InpBackColor,InpBorderColor,InpBack,InpSelection,InpHidden,InpZOrder))

     {

      return(INIT_FAILED);

     }

//--- ?>43>B02;8205< :=>?:8

   PrepareButtons();

   ExtInitialized=true;

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//--- C40;O5< >1J5:B OBJ_EDIT A 3@0D8:0

   ObjectDelete(0,InpName);

//--- C40;O5< 8=D>@<0F8>==K5 ?>;O

   ObjectDelete(0,"edt_xcoord");

   ObjectDelete(0,"edt_ycoord");

   ObjectDelete(0,"edt_corner");

   ObjectDelete(0,"edt_align");

   ObjectDelete(0,"edt_read_only");

   ObjectDelete(0,"edt_selectable");

//--- C40;O5< :=>?:8

   ObjectDelete(0,"btn_read_only");

   ObjectDelete(0,"btn_selectable");

//--- C40;O5< :=>?:8 C?@02;5=8O C3;>< ?@82O7:8

   ObjectDelete(0,"btn_corner_left_upper");

   ObjectDelete(0,"btn_corner_left_lower");

   ObjectDelete(0,"btn_corner_right_upper");

   ObjectDelete(0,"btn_corner_right_lower");

//--- C40;O5< :=>?:8 C?@02;5=8O 2K@02=820=85<

   ObjectDelete(0,"btn_align_left");

   ObjectDelete(0,"btn_align_center");

   ObjectDelete(0,"btn_align_right");

//--- C40;O5< :=>?:8 C?@02;5=8O :>>@48=0B0<8

   ObjectDelete(0,"btn_dec_y");

   ObjectDelete(0,"btn_inc_y");

   ObjectDelete(0,"btn_inc_x");

   ObjectDelete(0,"btn_dec_x");

  }

//+------------------------------------------------------------------+

//| ChartEvent function                                              |

//+------------------------------------------------------------------+

void OnChartEvent(const int id,

                  const long &lparam,

                  const double &dparam,

                  const string &sparam)

  {

   int x=0,y=0;

   bool res=true;

//---

   if(!ExtInitialized)

      return;

//---   

   int current_corner=(int)ObjectGetInteger(0,InpName,OBJPROP_CORNER);

   bool inv_coord_corner_mode_x=false;

   bool inv_coord_corner_mode_y=false;

//--- A?>A>1 ?@8@0I5=8O :>>@48=0B ?@8 7040==>< C3;5 ?@82O7:8

   switch(current_corner)

     {

      case CORNER_LEFT_LOWER:  {inv_coord_corner_mode_y=true; break;}

      case CORNER_RIGHT_UPPER: {inv_coord_corner_mode_x=true; break;}

      case CORNER_RIGHT_LOWER: {inv_coord_corner_mode_x=true; 

                                inv_coord_corner_mode_y=true; break;}

     }

//--- A1@>A8< 7=0G5=85 >H81:8

   ResetLastError();

//--- ?@>25@:0 A>1KB8O =060B8O =0 :=>?:C <KH8

   if(id==CHARTEVENT_OBJECT_CLICK)

     {

      Comment("CHARTEVENT_CLICK: "+sparam);



      //--- :=>?:0 C?@02;5=8O A2>9AB2>< readonly

      if(sparam=="btn_read_only")

        {

         bool read_only=(bool)ObjectGetInteger(0,InpName,OBJPROP_READONLY);

         read_only=!read_only;

         res=ObjectSetInteger(0,InpName,OBJPROP_READONLY,read_only);

        }

      //--- :=>?:0 C?@02;5=8O A2>9AB2>< selectable

      if(sparam=="btn_selectable")

        {

         bool selectable=(bool)ObjectGetInteger(0,InpName,OBJPROP_SELECTABLE);

         selectable=!selectable;

         res=ObjectSetInteger(0,InpName,OBJPROP_SELECTABLE,selectable);

        }



      //--- :=>?:8 C?@02;5=8O A2>9AB2>< ALIGN >1J5:B0 Edit

      if(sparam=="btn_align_left")

        {

         res=ObjectSetInteger(0,InpName,OBJPROP_ALIGN,ALIGN_LEFT);

        }

      if(sparam=="btn_align_center")

        {

         res=ObjectSetInteger(0,InpName,OBJPROP_ALIGN,ALIGN_CENTER);

        }

      if(sparam=="btn_align_right")

        {

         res=ObjectSetInteger(0,InpName,OBJPROP_ALIGN,ALIGN_RIGHT);

        }



      //--- :=>?:8 C?@02;5=8O :>>@48=0B0<8 >1J5:B0 Edit

      if(sparam=="btn_inc_x")

        {

         ButtonPressed(ExtCoordIncXButton,COORD_BUTTON);

         x=(int)ObjectGetInteger(0,InpName,OBJPROP_XDISTANCE);

         if(!inv_coord_corner_mode_x) x+=20; else x-=20;

         if(x>ExtChartWidth) x=(int)ExtChartWidth;

         if(x<0) x=0;

         res=ObjectSetInteger(0,InpName,OBJPROP_XDISTANCE,x);

         UnSelectButton(ExtCoordIncXButton);

        }

      if(sparam=="btn_dec_x")

        {

         ButtonPressed(ExtCoordDecXButton,COORD_BUTTON);

         x=(int)ObjectGetInteger(0,InpName,OBJPROP_XDISTANCE);

         if(!inv_coord_corner_mode_x) x-=20; else x+=20;

         if(x<0) x=0;

         res=ObjectSetInteger(0,InpName,OBJPROP_XDISTANCE,x);

         UnSelectButton(ExtCoordDecXButton);

        }

      if(sparam=="btn_inc_y")

        {

         ButtonPressed(ExtCoordIncYButton,COORD_BUTTON);

         y=(int)ObjectGetInteger(0,InpName,OBJPROP_YDISTANCE);

         if(!inv_coord_corner_mode_y) y+=20; else y-=20;

         if(y<0) y=0;

         if(y>ExtChartHeight) y=(int)ExtChartHeight;

         res=ObjectSetInteger(0,InpName,OBJPROP_YDISTANCE,y);

         UnSelectButton(ExtCoordIncYButton);

        }

      if(sparam=="btn_dec_y")

        {

         ButtonPressed(ExtCoordDecYButton,COORD_BUTTON);

         y=(int)ObjectGetInteger(0,InpName,OBJPROP_YDISTANCE);

         //         y-=20;

         if(!inv_coord_corner_mode_y) y-=20; else y+=20;

         if(y<0) y=0;

         if(y>ExtChartHeight) y=(int)ExtChartHeight;

         res=ObjectSetInteger(0,InpName,OBJPROP_YDISTANCE,y);

         UnSelectButton(ExtCoordDecYButton);

        }



      //--- :=>?:8 C?@02;5=8O C3;>< 3@0D8:0 4;O ?@82O7:8 (OBJPROP_CORNER)

      if(sparam=="btn_corner_left_upper")

        {

         res=ObjectSetInteger(0,InpName,OBJPROP_CORNER,CORNER_LEFT_UPPER);

        }

      if(sparam=="btn_corner_left_lower")

        {

         res=ObjectSetInteger(0,InpName,OBJPROP_CORNER,CORNER_LEFT_LOWER);

        }

      if(sparam=="btn_corner_right_upper")

        {

         res=ObjectSetInteger(0,InpName,OBJPROP_CORNER,CORNER_RIGHT_UPPER);

        }

      if(sparam=="btn_corner_right_lower")

        {

         res=ObjectSetInteger(0,InpName,OBJPROP_CORNER,CORNER_RIGHT_LOWER);

        }



      if(!res)

         Print("5 C40;>AL 87<5=8BL ?0@0<5B@! >4 >H81:8 = ",GetLastError());

      else

        {

         ShowInfo(0,InpName);

         ChartRedraw();

        }

     }

  }

//+------------------------------------------------------------------+

//| !>7405B >1J5:B ">;5 22>40"                                      |

//+------------------------------------------------------------------+

bool EditCreate(const long             chart_ID=0,               // ID 3@0D8:0

                const string           name="Edit",              // 8<O >1J5:B0

                const int              sub_window=0,             // =><5@ ?>4>:=0

                const int              x=0,                      // :>>@48=0B0 ?> >A8 X

                const int              y=0,                      // :>>@48=0B0 ?> >A8 Y

                const int              width=50,                 // H8@8=0

                const int              height=18,                // 2KA>B0

                const string           text="Text",              // B5:AB

                const string           font="Arial",             // H@8DB

                const int              font_size=10,             // @07<5@ H@8DB0

                const ENUM_ALIGN_MODE  align=ALIGN_CENTER,       // A?>A>1 2K@02=820=8O

                const bool             read_only=false,          // 2>7<>6=>ABL @540:B8@>20BL

                const ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER, // C3>; 3@0D8:0 4;O ?@82O7:8

                const color            clr=clrBlack,             // F25B B5:AB0

                const color            back_clr=clrWhite,        // F25B D>=0

                const color            border_clr=clrNONE,       // F25B 3@0=8FK

                const bool             back=false,               // =0 704=5< ?;0=5

                const bool             selection=false,          // 2K45;8BL 4;O ?5@5<5I5=89

                const bool             hidden=true,              // A:@KB 2 A?8A:5 >1J5:B>2

                const long             z_order=0)                // ?@8>@8B5B =0 =060B85 <KHLN

  {

//--- A1@>A8< 7=0G5=85 >H81:8

   ResetLastError();

//--- A>74048< ?>;5 22>40

   if(!ObjectCreate(chart_ID,name,OBJ_EDIT,sub_window,0,0))

     {

      Print(__FUNCTION__,

            ": =5 C40;>AL A>740BL >1J5:B \">;5 22>40\"! >4 >H81:8 = ",GetLastError());

      return(false);

     }

//--- CAB0=>28< :>>@48=0BK >1J5:B0

   ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);

   ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);

//--- CAB0=>28< @07<5@K >1J5:B0

   ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width);

   ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height);

//--- CAB0=>28< B5:AB

   ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);

//--- CAB0=>28< H@8DB B5:AB0

   ObjectSetString(chart_ID,name,OBJPROP_FONT,font);

//--- CAB0=>28< @07<5@ H@8DB0

   ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);

//--- CAB0=>28< A?>A>1 2K@02=820=8O B5:AB0 2 >1J5:B5

   ObjectSetInteger(chart_ID,name,OBJPROP_ALIGN,align);

//--- CAB0=>28< (true) 8;8 >B<5=8< (false) @568< B>;L:> 4;O GB5=8O

   ObjectSetInteger(chart_ID,name,OBJPROP_READONLY,read_only);

//--- CAB0=>28< C3>; 3@0D8:0, >B=>A8B5;L=> :>B>@>3> 1C4CB >?@545;OBLAO :>>@48=0BK >1J5:B0

   ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);

//--- CAB0=>28< F25B B5:AB0

   ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);

//--- CAB0=>28< F25B D>=0

   ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,back_clr);

//--- CAB0=>28< F25B 3@0=8FK

   ObjectSetInteger(chart_ID,name,OBJPROP_BORDER_COLOR,border_clr);

//--- >B>1@078< =0 ?5@54=5< (false) 8;8 704=5< (true) ?;0=5

   ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);

//--- 2:;NG8< (true) 8;8 >B:;NG8< (false) @568< ?5@5<5I5=8O <5B:8 <KHLN

   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);

   ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);

//--- A:@>5< (true) 8;8 >B>1@078< (false) 8<O 3@0D8G5A:>3> >1J5:B0 2 A?8A:5 >1J5:B>2

   ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);

//--- CAB0=>28< ?@8>@8B5B =0 ?>;CG5=85 A>1KB8O =060B8O <KH8 =0 3@0D8:5

   ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);

//--- CA?5H=>5 2K?>;=5=85

   return(true);

  }

//+------------------------------------------------------------------+

//| !>7405B :=>?:8                                                   |

//+------------------------------------------------------------------+

void PrepareButtons()

  {

//---

   int x0=0;

   int y0=0;

//---

   CreateEdit("xcoord",ExtXCoordinateInfo,x0+8,y0+34,70,20);

   CreateEdit("ycoord",ExtYCoordinateInfo,x0+78,y0+34,70,20);

   CreateEdit("corner",ExtCornerInfo,x0+8,y0+54,140,20);

   CreateEdit("align",ExtAlignInfo,x0+8,y0+74,140,20);



   CreateEdit("read_only",ExtReadOnlyInfo,x0+8+140,y0+54,100,20);

   CreateEdit("selectable",ExtSelectableInfo,x0+8+140,y0+74,100,20);



   CreateButton("read_only",ExtReadOnlyButton,x0+250,y0+55,80,20);

   CreateButton("selectable",ExtSelectableButton,x0+250,y0+75,80,20);

//---

   CreateButton("corner_left_upper",ExtCornerLUButton,x0+10,y0+100,150,20);

   CreateButton("corner_left_lower",ExtCornerLLButton,x0+10,y0+123,150,20);

   CreateButton("corner_right_upper",ExtCornerRUButton,x0+163,y0+100,150,20);

   CreateButton("corner_right_lower",ExtCornerRLButton,x0+163,y0+123,150,20);

//---   

   CreateButton("align_left",ExtAlignLButton,x0+10,y0+150,150,20);

   CreateButton("align_center",ExtAlignCButton,x0+163,y0+150,150,20);

   CreateButton("align_right",ExtAlignRButton,+x0+16+2*150,y0+150,150,20);

//---

   CreateButton("dec_y",ExtCoordDecYButton,x0+413,y0+36,25,25);

   CreateButton("inc_y",ExtCoordIncYButton,x0+413,y0+92,25,25);

   CreateButton("inc_x",ExtCoordIncXButton,x0+441,y0+64,25,25);

   CreateButton("dec_x",ExtCoordDecXButton,x0+385,y0+64,25,25);

//---

   ExtCoordIncXButton.FontSize(15);

   ExtCoordDecXButton.FontSize(15);

   ExtCoordIncYButton.FontSize(15);

   ExtCoordDecYButton.FontSize(15);

//---

   ExtCoordIncXButton.Font("Wingdings");

   ExtCoordDecXButton.Font("Wingdings");

   ExtCoordIncYButton.Font("Wingdings");

   ExtCoordDecYButton.Font("Wingdings");

//---

   ExtCoordIncXButton.Description(CharToString(240));

   ExtCoordDecXButton.Description(CharToString(239));

   ExtCoordIncYButton.Description(CharToString(242));

   ExtCoordDecYButton.Description(CharToString(241));

//--- ?>:07K205< B5:CI85 A2>9AB20 A 8<5=5< InpName

   ShowInfo(0,InpName);

  }

//+------------------------------------------------------------------+

//| >:07K205B 8=D>@<0F8N > :>>@48=0B0E 8 A2>9AB20E ?@82O7:8         |

//+------------------------------------------------------------------+

void ShowInfo(const long chart_ID,const string name)

  {

   int current_corner=(int)ObjectGetInteger(chart_ID,name,OBJPROP_CORNER);

   int current_align=(int)ObjectGetInteger(chart_ID,name,OBJPROP_ALIGN);

   bool read_only=(bool)ObjectGetInteger(chart_ID,name,OBJPROP_READONLY);

   bool selectable=(bool)ObjectGetInteger(chart_ID,name,OBJPROP_SELECTABLE);

//---

   string sel="selectable=";

   if(selectable) sel+="true"; else sel+="false";

   ExtSelectableButton.State(selectable);

   ExtSelectableInfo.Description(sel);

//---

   string ro="read_only=";

   if(read_only) ro+="true"; else ro+="false";

   ExtReadOnlyButton.State(read_only);

   ExtReadOnlyInfo.Description(ro);

//---

   switch(current_corner)

     {

      case CORNER_LEFT_UPPER:  ButtonPressed(ExtCornerLUButton,CORNER_BUTTON); break;

      case CORNER_LEFT_LOWER:  ButtonPressed(ExtCornerLLButton,CORNER_BUTTON); break;

      case CORNER_RIGHT_LOWER: ButtonPressed(ExtCornerRLButton,CORNER_BUTTON); break;

      case CORNER_RIGHT_UPPER: ButtonPressed(ExtCornerRUButton,CORNER_BUTTON); break;

     }

//---

   switch(current_align)

     {

      case ALIGN_LEFT:        ButtonPressed(ExtAlignLButton,ALIGN_BUTTON); break;

      case ALIGN_CENTER:      ButtonPressed(ExtAlignCButton,ALIGN_BUTTON); break;

      case ALIGN_RIGHT:       ButtonPressed(ExtAlignRButton,ALIGN_BUTTON); break;

     }

//---

   int x=(int)ObjectGetInteger(chart_ID,name,OBJPROP_XDISTANCE);

   int y=(int)ObjectGetInteger(chart_ID,name,OBJPROP_YDISTANCE);

//---

   ExtXCoordinateInfo.Description(IntegerToString(x));

   ExtYCoordinateInfo.Description(IntegerToString(y));

//---

   ExtCornerInfo.Description(EnumToString(ENUM_BASE_CORNER(current_corner)));

   ExtAlignInfo.Description(EnumToString(ENUM_ALIGN_MODE(current_align)));

  }

//+------------------------------------------------------------------+

//| UnSelectButton                                                   |

//+------------------------------------------------------------------+

void UnSelectButton(CChartObjectButton &btn)

  {

   btn.State(false);

   btn.BackColor(clrAliceBlue);

  }

//+------------------------------------------------------------------+

//| C>7405B :=>?:C (>1J5:B B8?0 CChartObjectButton)                  |

//+------------------------------------------------------------------+

bool CreateButton(string text,CChartObjectButton &btn,int x0,int y0,int width,int height)

  {

   if(!btn.Create(0,"btn_"+text,0,x0,y0,width,height))

      return(false);

   btn.Font("Verdana");

   btn.FontSize(7);

   StringToUpper(text);

   btn.Description(text);

   btn.State(false);

   UnSelectButton(btn);

//---

   return(true);

  }

//+------------------------------------------------------------------+

//| C>7405B >1J5:B B8?0 CChartObjectEdit                             |

//+------------------------------------------------------------------+

bool CreateEdit(string name,CChartObjectEdit &edit,int x0,int y0,int width,int height)

  {

   if(!edit.Create(0,"edt_"+name,0,x0,y0,width,height))

      return(false);

   edit.Font("Verdana");

   edit.FontSize(7);

   edit.BackColor(clrIvory);

   edit.Description("");

   edit.ReadOnly(true);

//---

   return(true);

  }

//+------------------------------------------------------------------+

//| UnselectButtons                                                  |

//+------------------------------------------------------------------+

void UnselectButtons(ENUM_BUTTON_TYPE buttontype)

  {

   switch(buttontype)

     {

      case ALIGN_BUTTON:

        {

         UnSelectButton(ExtAlignLButton);

         UnSelectButton(ExtAlignCButton);

         UnSelectButton(ExtAlignRButton);

         break;

        }

      case CORNER_BUTTON:

        {

         UnSelectButton(ExtCornerLUButton);

         UnSelectButton(ExtCornerLLButton);

         UnSelectButton(ExtCornerRUButton);

         UnSelectButton(ExtCornerRLButton);

         break;

        }

      case COORD_BUTTON:

        {

         UnSelectButton(ExtCoordIncXButton);

         UnSelectButton(ExtCoordDecXButton);

         UnSelectButton(ExtCoordIncYButton);

         UnSelectButton(ExtCoordDecYButton);

         break;

        }

     }

  }

//+------------------------------------------------------------------+

//| ButtonPressed                                                    |

//+------------------------------------------------------------------+

bool ButtonPressed(CChartObjectButton &btn,ENUM_BUTTON_TYPE buttontype)

  {

   UnselectButtons(buttontype);

//---

   bool state=!btn.State();

   btn.State(state);

   if(state)

      btn.BackColor(clrHoneydew);

   else

      btn.BackColor(clrAliceBlue);

//---     

   return(true);

  }

//+------------------------------------------------------------------+

Comments