Обсуждение статьи "Графические интерфейсы X: Новые возможности для нарисованной таблицы (build 9)" - страница 2

 
Artyom Trishkin:
Yes, it works for me too, but with old library.

Do it with new Build6,7,8 or 9 please.
 
Anatoli Kazharski:
Используйте MetaTrader 5. Версия для MetaTrader 4 больше не поддерживается и я ничего не могу подсказать.
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 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.

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);
Outside the body of the class, you create a method body:
//+------------------------------------------------------------------+
//| Создаёт цветовую палитру для выбора цвета                        |
//+------------------------------------------------------------------+
bool CWndEvents::CreateColorPicker(CColorPicker &color_picker, CWindow &wnd_pointer, int wnd_index, int x, int y)
  {
//--- пересчитаем координаты
   int x_gap=x-wnd_pointer.X();
   int y_gap=y-wnd_pointer.Y();
//--- Сохраним указатель на окно
   color_picker.WindowPointer(wnd_pointer);
//--- Создание элемента
   if(!color_picker.CreateColorPicker(m_chart_id,m_subwin,x_gap,y_gap))
      return(false);
//--- Добавим указатель на элемент в базу
   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);
Look at this example:


 
stt:
...
I know that You not support MQL4 version, but I think that MQL4 is not a reason.
Покажите, пожалуйста, скриншоты или видео, на которых показана проблема, а также приложите к сообщению файлы для тестов (MetaTrader 5).
 
Artyom Trishkin:
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.
......

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.
 
спасибо за труды!! сортировать по столбцам и удалять строки возможно в этой версии?
 
stt:
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.
Please. Look at this:

 
dantetemp:
спасибо за труды!! сортировать по столбцам и удалять строки возможно в этой версии?
Пока нет. Но скоро будет. 
 
dantetemp:
спасибо за труды!! сортировать по столбцам и удалять строки возможно в этой версии?
@dantetemp, уже возможно. Скачайте последнюю версию библиотеки из этой статьи: Графические интерфейсы X: Сортировка, реконструкция таблицы и элементы управления в ячейках (build 11)
 

Добрый день. Возник такой вопрос: есть поле ввода SpinEdit:

bool CProgram::CreateSpinEdit_TradingLot(const string text)
{
//--- Сохраним указатель на окно
   m_spin_edit_Trading_lot.WindowPointer(m_window);
   m_tabs.AddToElementsArray(1,m_spin_edit_Trading_lot);
//--- Координаты
   int x=m_window.X()+SPINEDIT14_GAP_X;
   int y=m_window.Y()+SPINEDIT14_GAP_Y;
//--- Значение
   double v=(m_spin_edit_Trading_lot.GetValue()==WRONG_VALUE) ? 0.01 : m_spin_edit_Trading_lot.GetValue();
//--- Установим свойства перед созданием
   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);
//--- Создадим элемент управления
   if(!m_spin_edit_Trading_lot.CreateSpinEdit(m_chart_id,m_subwin,text,x,y))
      return(false);
//--- Добавим объект в общий массив групп объектов
   CWndContainer::AddToElementsArray(0,m_spin_edit_Trading_lot);
   return(true);
}


Есть обработчик событий:

void CProgram::OnEventSpinEdit_TradingLot(void)
{
   TradingLot = m_spin_edit_Trading_lot.GetValue();
   Print("TradingLot = " + NormalizeDouble(TradingLot,2));
}

И даже после функции NormalizeDouble  получаю такие значения при нажатие на инкремент/декремент справа от поля ввода:


При вводе с клавиатуры все правильно.

В чем может быть причина ? 

Причина обращения: