Anatoli Kazharski: Use MetaTrader 5. The MetaTrader 4 version is no longer supported and I cannot advise you on anything.
Thank yo for your answer. (n.b. I asked if it works with new build)
Is below OK?
//+------------------------------------------------------------------+ //| Создаёт общую площадь | //+------------------------------------------------------------------+ bool CColorPicker::CreateArea(void) { //--- Формирование имени объекта string name=CElementBase::ProgramName()+"_color_picker_bg_"+(string)CElementBase::Id(); //--- Координаты int x=CElementBase::X(); int y=CElementBase::Y(); //--- Создать объект if(!m_area.Create(m_chart_id,name,m_subwin,x,y,m_x_size,m_y_size)) return(false); //--- Свойства m_area.BackColor(m_area_color); m_area.Color(m_area_border_color); m_area.BorderType(BORDER_FLAT); m_area.Corner(m_corner); m_area.Selectable(false); m_area.Z_Order(m_area_zorder); m_area.Tooltip("\n"); //--- Координаты m_canvas.X(x); m_canvas.Y(y); //--- Размеры m_canvas.XSize(m_x_size); m_canvas.YSize(m_y_size); //--- Отступы от крайней точки m_area.XGap(CElement::CalculateXGap(x)); m_area.YGap(CElement::CalculateYGap(y)); //--- Сохраним указатель объекта CElementBase::AddToArray(m_area); return(true); }
stt: Thank yo for your answer. (n.b. I asked if it works with new build)
Is below OK?
//+------------------------------------------------------------------+ //| Создаёт общую площадь | //+------------------------------------------------------------------+ bool CColorPicker::CreateArea(void) { //--- Формирование имени объекта string name=CElementBase::ProgramName()+"_color_picker_bg_"+(string)CElementBase::Id(); //--- Координаты int x=CElementBase::X(); int y=CElementBase::Y(); //--- Создать объект if(!m_area.Create(m_chart_id,name,m_subwin,x,y,m_x_size,m_y_size)) return(false); //--- Свойства m_area.BackColor(m_area_color); m_area.Color(m_area_border_color); m_area.BorderType(BORDER_FLAT); m_area.Corner(m_corner); m_area.Selectable(false); m_area.Z_Order(m_area_zorder); m_area.Tooltip("\n"); //--- Координаты m_canvas.X(x); m_canvas.Y(y); //--- Размеры m_canvas.XSize(m_x_size); m_canvas.YSize(m_y_size); //--- Отступы от крайней точки m_area.XGap(CElement::CalculateXGap(x)); m_area.YGap(CElement::CalculateYGap(y)); //--- Сохраним указатель объекта CElementBase::AddToArray(m_area); return(true); }
The latest versions of thelibrary,object coordinatecalculationwas different.You need toeither use thenew rulesspecifycoordinates of the object, orin their ownmethodsto recalculate thecoordinates in theusualyou.
For example you need:
In WndEvents.mqh in public area create a new method:
//--- Creates a colour palette for colour selection bool CreateColorPicker(CColorPicker &color_picker, CWindow &wnd_pointer, int wnd_index,int x,int y);
Outsidethe body of the class,you create amethod body:
//+------------------------------------------------------------------+ //|| Creates a colour palette for selecting a colour || //+------------------------------------------------------------------+ bool CWndEvents::CreateColorPicker(CColorPicker &color_picker, CWindow &wnd_pointer, int wnd_index, int x, int y) { //--- recalculate the coordinates int x_gap=x-wnd_pointer.X(); int y_gap=y-wnd_pointer.Y(); //--- Save the window pointer color_picker.WindowPointer(wnd_pointer); //--- Creating an element if(!color_picker.CreateColorPicker(m_chart_id,m_subwin,x_gap,y_gap)) return(false); //--- Add a pointer to the element in the base CWndContainer::AddToElementsArray(wnd_index,color_picker); return(true); } //+------------------------------------------------------------------+
And in CProgram.mqh, create your ColorPicker:
//--- Color picker x=m_window_main.X2()+1; y=m_window_main.Y(); if(!CreateColorPicker(m_color_picker,m_window_main,m_window_main_index,x,y)) return(false);
Artyom Trishkin: The latest versions of thelibrary,object coordinatecalculationwas different.You need toeither use thenew rulesspecifycoordinates of the object, orin their ownmethodsto recalculatethe coordinates in theusualyou. ......
Thank you for tutorial. I checked and changed coordinatecalculation. ColorPicker works well in my environment but only when displayed in main window (W_MAIN).
Could you check it in W_DIALOG window please?
ColorPicker in this library is very powerfull tool for fine tuning custom colours, but I wonder if simple colour table woud be more convenient for everyday use.
stt: Thank you for tutorial. I checked and changed coordinatecalculation. ColorPicker works well in my environment but only when displayed in main window (W_MAIN).
Could you check it in W_DIALOG window please?
ColorPicker in this library is very powerfull tool for fine tuning custom colours, but I wonder if simple colour table woud be more convenient for everyday use.
Good afternoon. I have the following question: there is an input field SpinEdit:
bool CProgram::CreateSpinEdit_TradingLot(conststring text)
{
//--- Save the window pointer
m_spin_edit_Trading_lot.WindowPointer(m_window);
m_tabs.AddToElementsArray(1,m_spin_edit_Trading_lot);
//--- Coordinatesint x=m_window.X()+SPINEDIT14_GAP_X;
int y=m_window.Y()+SPINEDIT14_GAP_Y;
//--- Valuedouble v=(m_spin_edit_Trading_lot.GetValue()==WRONG_VALUE) ? 0.01 : m_spin_edit_Trading_lot.GetValue();
//--- Set properties before creation
m_spin_edit_Trading_lot.XSize(90);
m_spin_edit_Trading_lot.YSize(18);
m_spin_edit_Trading_lot.EditXSize(50);
m_spin_edit_Trading_lot.MaxValue(100);
m_spin_edit_Trading_lot.MinValue(0.01);
m_spin_edit_Trading_lot.StepValue(0.01);
m_spin_edit_Trading_lot.SetDigits(2);
m_spin_edit_Trading_lot.SetValue(v);
m_spin_edit_Trading_lot.ResetMode(false);
m_spin_edit_Trading_lot.AreaColor(clrWhite);
//--- Create a controlif(!m_spin_edit_Trading_lot.CreateSpinEdit(m_chart_id,m_subwin,text,x,y))
return(false);
//--- Add the object to the common array of object groups
CWndContainer::AddToElementsArray(0,m_spin_edit_Trading_lot);
return(true);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Do it with new Build6,7,8 or 9 please.
Use MetaTrader 5. The MetaTrader 4 version is no longer supported and I cannot advise you on anything.
Is below OK?
//| Создаёт общую площадь |
//+------------------------------------------------------------------+
bool CColorPicker::CreateArea(void)
{
//--- Формирование имени объекта
string name=CElementBase::ProgramName()+"_color_picker_bg_"+(string)CElementBase::Id();
//--- Координаты
int x=CElementBase::X();
int y=CElementBase::Y();
//--- Создать объект
if(!m_area.Create(m_chart_id,name,m_subwin,x,y,m_x_size,m_y_size))
return(false);
//--- Свойства
m_area.BackColor(m_area_color);
m_area.Color(m_area_border_color);
m_area.BorderType(BORDER_FLAT);
m_area.Corner(m_corner);
m_area.Selectable(false);
m_area.Z_Order(m_area_zorder);
m_area.Tooltip("\n");
//--- Координаты
m_canvas.X(x);
m_canvas.Y(y);
//--- Размеры
m_canvas.XSize(m_x_size);
m_canvas.YSize(m_y_size);
//--- Отступы от крайней точки
m_area.XGap(CElement::CalculateXGap(x));
m_area.YGap(CElement::CalculateYGap(y));
//--- Сохраним указатель объекта
CElementBase::AddToArray(m_area);
return(true);
}
Thank yo for your answer. (n.b. I asked if it works with new build)
Is below OK?
//| Создаёт общую площадь |
//+------------------------------------------------------------------+
bool CColorPicker::CreateArea(void)
{
//--- Формирование имени объекта
string name=CElementBase::ProgramName()+"_color_picker_bg_"+(string)CElementBase::Id();
//--- Координаты
int x=CElementBase::X();
int y=CElementBase::Y();
//--- Создать объект
if(!m_area.Create(m_chart_id,name,m_subwin,x,y,m_x_size,m_y_size))
return(false);
//--- Свойства
m_area.BackColor(m_area_color);
m_area.Color(m_area_border_color);
m_area.BorderType(BORDER_FLAT);
m_area.Corner(m_corner);
m_area.Selectable(false);
m_area.Z_Order(m_area_zorder);
m_area.Tooltip("\n");
//--- Координаты
m_canvas.X(x);
m_canvas.Y(y);
//--- Размеры
m_canvas.XSize(m_x_size);
m_canvas.YSize(m_y_size);
//--- Отступы от крайней точки
m_area.XGap(CElement::CalculateXGap(x));
m_area.YGap(CElement::CalculateYGap(y));
//--- Сохраним указатель объекта
CElementBase::AddToArray(m_area);
return(true);
}
For example you need:
In WndEvents.mqh in public area create a new method:
bool CreateColorPicker(CColorPicker &color_picker, CWindow &wnd_pointer, int wnd_index,int x,int y);
//|| Creates a colour palette for selecting a colour ||
//+------------------------------------------------------------------+
bool CWndEvents::CreateColorPicker(CColorPicker &color_picker, CWindow &wnd_pointer, int wnd_index, int x, int y)
{
//--- recalculate the coordinates
int x_gap=x-wnd_pointer.X();
int y_gap=y-wnd_pointer.Y();
//--- Save the window pointer
color_picker.WindowPointer(wnd_pointer);
//--- Creating an element
if(!color_picker.CreateColorPicker(m_chart_id,m_subwin,x_gap,y_gap))
return(false);
//--- Add a pointer to the element in the base
CWndContainer::AddToElementsArray(wnd_index,color_picker);
return(true);
}
//+------------------------------------------------------------------+
And in CProgram.mqh, create your ColorPicker:
x=m_window_main.X2()+1;
y=m_window_main.Y();
if(!CreateColorPicker(m_color_picker,m_window_main,m_window_main_index,x,y))
return(false);
...
I know that You do not support MQL4 version, but I think that MQL4 is not a reason.
The latest versions of the library, object coordinate calculation was different. You need to either use the new rules specify coordinates of the object, or in their own methods to recalculate the coordinates in the usual you.
......
Could you check it in W_DIALOG window please?
ColorPicker in this library is very powerfull tool for fine tuning custom colours, but I wonder if simple colour table woud be more convenient for everyday use.
Thank you for tutorial. I checked and changed coordinate calculation. ColorPicker works well in my environment but only when displayed in main window (W_MAIN).
Could you check it in W_DIALOG window please?
ColorPicker in this library is very powerfull tool for fine tuning custom colours, but I wonder if simple colour table woud be more convenient for everyday use.
thanks for your labours!!! is sorting by column and deleting rows possible in this version?
thanks for your labours!!! is sorting by column and deleting rows possible in this version?
Good afternoon. I have the following question: there is an input field SpinEdit:
There is an event handler:
And even after the NormalizeDouble function I get such values when I click on the increment/decrement to the right of the input field:
When entering from the keyboard, everything is correct.
What can be the reason ?