程序库: 用于创建图形界面的 EasyAndFastGUI 开发库 - 页 20

 

今天我开始使用这个库,构建时间为 2019.03.13 16:43(我认为是构建 16)。我用它来创建表格,效果几乎完美,我参考了以下文章:

https://www.mql5.com/zh/articles/2500#para6

https://www.mql5.com/zh/articles/2897#para7

对我来说,排序功能很重要,所以我根据文章 "X "中的说明使用了该库。如果我使用那个版本(版本 6),表格运行得非常好,但如果我使用最后一个版本(版本 16),当我点击标题单元格时,表格不能对元素进行排序。

调查主要差异后,我在 Table.mqh 文件中发现了这个问题。


这是版本 6 中的情况:

void CTable::SortData(const uint column_index=0)
{
   ...
   //--- 存储最后排序数据列的索引
   m_is_sorted_column_index=(int)column_index;
   //--- 排序
   QuickSort(first_index,last_index,column_index,m_last_sort_direction);
   //-- 更新表格
   UpdateTable();
   //--- 根据排序方向设置图标
   m_sort_arrow.State((m_last_sort_direction==SORT_ASCEND)? true : false);
}

这是在第 16 版中:

void CTable::SortData(const uint column_index=0,const int direction=WRONG_VALUE)
{
   ...
   //--- Запомним индекс последнего отсортированного столбца данных
   m_is_sorted_column_index=(int)column_index;
   //-- Сортировка
   QuickSort(first_index,last_index,column_index,m_last_sort_direction);
}


在新版中没有 "更新 "方法,因此我认为这是无法排序的原因。


因此,我做了这一更改,显然起了作用:

void CTable::SortData(const uint column_index=0,const int direction=WRONG_VALUE)
{
   ...
   //--- Запомним индекс последнего отсортированного столбца данных
   m_is_sorted_column_index=(int)column_index;
   //-- Сортировка
   QuickSort(first_index,last_index,column_index,m_last_sort_direction);
   
   //-- 更新表格
   Update(true);
}



附注:俄语注释没有太大帮助。

Graphical Interfaces VII: the Tables Controls (Chapter 1)
Graphical Interfaces VII: the Tables Controls (Chapter 1)
  • www.mql5.com
The first article Graphical Interfaces I: Preparation of the Library Structure (Chapter 1) explains in detail what this library is for. You will find a list of articles with links at the end of each chapter. There, you can also download a complete version of the library at the current stage of development. The files must be placed in the same...
 

标签类在库中的位置?如何创建单个标签?

 

说古斯塔沃!美吗?

我也是绞尽脑汁才使图表排序成功的,我偶然得到了它......

有必要在 "program.mqh "的ON_SORT_DATA事件中更新表格,类似于这样:

// --- 排序表事件
if (id == CHARTEVENT_CUSTOM + ON_SORT_DATA)
{
if (lparam == m_table_symb.Id ())
{
m_table_symb.Update (true);
return;
}
// ---
return;
}


希望对您有所帮助!

这里效果很好

T +

劳尔

 
raulpjr:

这是一个英语论坛。请仅使用英语发帖。

如有必要,请使用网站的翻译工具。

发布代码时请使用代码按钮 (Alt +S)。

这次我编辑了您的帖子。

 

如果我在 MT4 中将库中的 ExampleEAF 作为指标构建,当我尝试在图表上拖动窗口时,指标会崩溃并出现错误。

在 MT5 中运行正常

array out of range in 'WndEvents.mqh' (288,72)

如果我在第一个周期中添加范围超限检查,拖动就会正常。

void CWndEvents::CheckElementsEvents(void)
  {
//--- 处理鼠标指针移动事件
   if(m_id==CHARTEVENT_MOUSE_MOVE)
     {
      //--- 如果表格位于图表的另一个子窗口中,则退出
      if(!m_windows[m_active_window_index].CheckSubwindowNumber())
         return;
      //--- 仅检查可用项目
      int available_elements_total=CWndContainer::AvailableElementsTotal(m_active_window_index);
      for(int e=0; e<available_elements_total; e++)
        {
         // !!!附加检查
         if (e >= ArraySize(m_wnd[m_active_window_index].m_available_elements)) continue;
         CElement *el=m_wnd[m_active_window_index].m_available_elements[e];
         //--- 检查元素上的焦点
         el.CheckMouseFocus();
         //--- 事件处理
         el.OnEvent(m_id,m_lparam,m_dparam,m_sparam);
        }
     }
//--- 除鼠标光标移动外的所有事件
   else
     {
      int elements_total=CWndContainer::ElementsTotal(m_active_window_index);
      for(int e=0; e<elements_total; e++)
        {
         //--- 仅检查可用项目
         CElement *el=m_wnd[m_active_window_index].m_elements[e];
         if(!el.IsVisible() || !el.IsAvailable() || el.IsLocked())
            continue;
         //--- 项目处理程序中的事件处理
         el.OnEvent(m_id,m_lparam,m_dparam,m_sparam);
        }
     }
//--- 将事件导向应用程序文件
   OnEvent(m_id,m_lparam,m_dparam,m_sparam);
  }

但将窗口 "扩展 "到整个图表区域后再返回时就会停止工作。

您能告诉我如何解决这个问题,使其在 MT4 中也能正常工作吗?

有什么区别?在 MT4 中编译时没有警告,我不知道该从哪个方向入手。


另外,在 MT4 中,当编译为指标时,焦点切换不起作用,也就是说,如果您打开一个下拉列表,然后点击一旁的某个地方,列表不会关闭,输入焦点也不会切换到另一个元素,而在专家模式下则正常工作。

在 MT5 中,专家顾问和指标均正常工作

 
下午好,请提示以某种方式可以实现从文本字段 复制和粘贴文本。
 

表格的另一个有趣故障。

在几次输入后,字符开始翻倍,然后再翻三倍(见 gif)。

问题出在哪里?

附加的文件:
ScreenFlow.gif  28 kb
 

CreateTextEdit好像不支持中文输入?


CreateTextEdit doesn't seem to support Chinese input?

 

您好

在哪里可以下载该库的 MT4 版本?

 
请问如何使用该库更改程序(Expert Advisor)的默认字体?它是从程序标题开始打印所有内容的字体。至少要改变字体大小(增大)。