Discussion of article "Graphical Interfaces XI: Integrating the Standard Graphics Library (build 16)"

 

New article Graphical Interfaces XI: Integrating the Standard Graphics Library (build 16) has been published:

A new version of the graphics library for creating scientific charts (the CGraphic class) has been presented recently. This update of the developed library for creating graphical interfaces will introduce a version with a new control for creating charts. Now it is even easier to visualize data of different types.

Earlier, the developed library had used a copy of the CCanvas class designed for drawing. Due to recent global refactoring of the library's code, this copy is no longer needed and it can be removed by replacing it with the original version from the standard library. This reduced the volume of the library by approximately 10% and almost by 40% relative to the version presented before the refactoring in the articles Graphical Interfaces XI: Refactoring the Library code (build 14.1) and Graphical Interfaces XI: Rendered controls (build 14.2).

The CGraphic class will now be used for creating charts.

 Fig. 7. Demonstration of an animated hypocycloid.

Fig. 7. Demonstration of an animated hypocycloid.

Author: Anatoli Kazharski

 

I downloaded the package, and create a demo GUI of CTable.

#include <\\EasyAndFastGUI\\WndEvents.mqh>

//+------------------------------------------------------------------+
//| Class for creating an application                                |
//+------------------------------------------------------------------+
class CGUI : public CWndEvents {
  private:
    CWindow           m_window;
    CTable            m_table;

  public:
    bool              CreateGUI(const int x, const int y, const string caption_text);

  private:
    bool              CreateWindow(const int x, const int y, const int x_size, const int y_size, const string text);
    bool              CreateTable(const int x_gap, const int y_gap);
};

bool CGUI::CreateGUI(const int x, const int y, const string caption_text) {
  int x_size = 400,
      y_size = 400;
  
  if (!CreateWindow(x, y, x_size, y_size, caption_text)) {
    return(false);
  }

  if (!CreateTable(1, 20)) {
    return(false);
  }

  m_chart.Redraw();
  return(true);
}

//+------------------------------------------------------------------+
//| Creates form 1 for controls                                      |
//+------------------------------------------------------------------+
bool CGUI::CreateWindow(const int x, const int y, const int x_size, const int y_size, const string caption_text) {
  CWndContainer::AddWindow(m_window);

  m_window.XSize(x_size);
  m_window.YSize(y_size);
  m_window.Alpha(255);

  m_window.IsMovable(true);
  m_window.ResizeMode(true);
  m_window.CloseButtonIsUsed(true);
  m_window.FullscreenButtonIsUsed(true);
  m_window.CollapseButtonIsUsed(true);
  m_window.TooltipsButtonIsUsed(true);
  m_window.RollUpSubwindowMode(true, true);
  m_window.TransparentOnlyCaption(true);

  //--- Set the tooltips
  m_window.GetCloseButtonPointer().Tooltip("Close");
  m_window.GetFullscreenButtonPointer().Tooltip("Fullscreen/Minimize");
  m_window.GetCollapseButtonPointer().Tooltip("Collapse/Expand");
  m_window.GetTooltipButtonPointer().Tooltip("Tooltips");

  m_window.BackColor((color)ChartGetInteger(m_chart_id, CHART_COLOR_BACKGROUND));
  m_window.BorderColor(clrMaroon);

  return(m_window.CreateWindow(m_chart_id, m_subwin, caption_text, x, y));
}

//+------------------------------------------------------------------+
//| Create a rendered table                                          |
//+------------------------------------------------------------------+
bool CGUI::CreateTable(const int x_gap,const int y_gap) {
  m_table.MainPointer(m_window);

  int x_size = 300,
      y_size = 300;

  int column_width[] = {100, 200};

  m_table.XSize(x_size);
  m_table.YSize(y_size);

  m_table.TableSize(2, 10);

  m_table.ColumnsWidth(column_width);
  m_table.CellYSize(30);

  ENUM_ALIGN_MODE column_align[];
  ArrayResize(column_align, 2);
  ::ArrayInitialize(column_align, ALIGN_RIGHT);
  m_table.TextAlign(column_align);

  color bg_color = (color)ChartGetInteger(m_chart_id, CHART_COLOR_BACKGROUND);
  m_table.CellColor(bg_color);
  m_table.GridColor(bg_color);
  m_table.BorderColor(bg_color);
  m_table.FontSize(12);

  /*
  CScrollV *scroll_v = m_table.GetScrollVPointer();
  scroll_v.ChangeThumbSize(0, 0);
  scroll_v.Hide();
  scroll_v.IsVisible(false);

  CScrollH *scroll_h = m_table.GetScrollHPointer();
  scroll_h.ChangeThumbSize(0, 0);
  scroll_h.Hide();
  scroll_h.IsVisible(false);
  //*/
   

  //m_table.TextXOffset(5);
  //m_table.TextYOffset(4);
  m_table.ShowHeaders(false);
  m_table.SelectableRow(false);
  m_table.ColumnResizeMode(false);
  //m_table.IsZebraFormatRows(clrWhiteSmoke);
  //m_table.AutoXResizeMode(true);
  //m_table.AutoXResizeRightOffset(1);
  //m_table.AutoYResizeMode(true);
  //m_table.AutoYResizeBottomOffset(25);

  if (!m_table.CreateTable(x_gap, y_gap)) {
    return(false);
  }

  CWndContainer::AddToElementsArray(0, m_table);

  m_table.Update(true);

  m_window.Update(true);

  return(true);
}

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   CGUI gui;
   gui.CreateGUI(10, 50, "Test GUI");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+

But I found CTable control alsways leave H/V scrollbar spaces, I could not remove them by Hide(), IsVisiable(false).


So, could you give me a workaround?

Thanks in advance,

David

 

I'm going to try

 

Hi,

Thanks for the great series of articles.
Is there a way to create a simple button to chart? (Not to a form) for MQL5
If so can you please give me an example?

Thanks in advance

 

very interest library but this last version is very very very very very very very slow to load applications, in addittion many method are missing.

I hope that a new version will be released

 

Hello,

First of all, thank you for this library !! In the last version, it's not possible to have a combobox with checkboxes inside, like the "old" checkboxlist..  do you implement this in another version? is seems that "CheckBoxMode(true)" doesn't work like i understood.

Thank you!

 

This is very good work.

I started learning OOP over the last 6 months and am looking to learn to create GUIs.

I wondered which library had the most functionality and would suit my needs to be used for my GUI projects.

I Downloaded "EasyandFastGUI", build 16, placed the files in the correct folders, started compiling each "Include" file, just to test them for errors.

Hopefully, this makes sense. I am getting the following errors when I compiled the "Element.mqh" file:

 

I know the question of:  "deprecated behavior, hidden method calling will be disabled in a future MQL compiler version", has been raised.

Responses have been given to similar questions. These include Mikhail Sergeev's response. So far I spent upwards of 5 hours trying to figure it out but no success so far.

Could someone please help?


Thank you.

 

Hi

Did anybody tried to run menus with this build   ...Previously I was using build 13 (no need in my interface  to have extra functionality from newer builds)    ..but I was trying to stay not behind  and start using new build (16)   ...and I'm not able to have Menus going.  Copy and paste code  (is working with build 13  (tested multiple times))    but with build 16  software is running with no errors but just menu bar is on the screen but no sub menus ....    any example code  (only regarding menu system)  would be appreciate :)


Thank you

(worst case scenario I will stay with build 13)

Reason: