Libraries: EasyAndFastGUI library for creating graphical interfaces - page 13

 

Good evening.

Mouse.mqh.

//+------------------------------------------------------------------+
//| Check if the state of the left mouse button has changed |
//+------------------------------------------------------------------+
bool CMouse::CheckChangeLeftButtonState(const string mouse_state)
  {
   bool left_button_state=(bool)int(mouse_state);
//--- Send a message about changing the state of the left mouse button
   if(m_left_button_state!=left_button_state)
      ::EventChartCustom(m_chart.ChartId(),ON_CHANGE_MOUSE_LEFT_BUTTON,0,0.0,"");
//--- Return the current state of the left mouse button
   return(left_button_state);
  }
//+------------------------------------------------------------------+

We pass sparam here and, as far as I understand, any non-zero value is treated as a pressed mouse button. But non-zero values are given by all mouse buttons, plus Shift and Control at least.

Is this the way it is intended?

 
Oleksii Chepurnyi:

Good evening.

Mouse.mqh

We pass sparam here and, as far as I understand, any non-zero value is treated as a pressed mouse button. But non-zero values are given by all mouse buttons, plus Shift and Control at least.

Is that the way it was intended?

No, it was just a temporary solution for my custom tasks.

It doesn't even seem to be used anywhere in the library right now. Can be refined if necessary.

 
Anatoli Kazharski:

No, it was just a temporary solution for my custom tasks.

It doesn't even seem to be used anywhere in the library at all right now. Can be refined if needed.

It is used very often :) For example, window dragging, SpinEdit quick swipe. Everywhere where the state of the LKM is checked.

I made it like this

//+------------------------------------------------------------------+
//| Check if the state of the left mouse button has changed |
//+------------------------------------------------------------------+
bool CMouse::CheckChangeLeftButtonState(const string mouse_state)
  {
   bool left_button_state=((int)mouse_state==1);
//--- Send a message about changing the state of the left mouse button
   if(m_left_button_state!=left_button_state)
      ::EventChartCustom(m_chart.ChartId(),ON_CHANGE_MOUSE_LEFT_BUTTON,0,0.0,"");
//--- Return the current state of the left mouse button
   return(left_button_state);
  }
//+------------------------------------------------------------------+
 
Anatoli Kazharski:

No, it was just a temporary solution for my custom tasks.

It doesn't even seem to be used anywhere in the library at all right now. Can be refined if needed.

In the latest release - https://www.mql5.com/en/code/19703

can't add

 //CCanvasTable m_canvas_table;

The problem seems to be that I'm looking at examples in old versions!


class CProgram : public CWndEvents
  {
protected:
   //--- Time counters
   CTimeCounter      m_counter1; // to update the execution process
   CTimeCounter      m_counter2; // to update items in the status bar
   //--- Main window
   CWindow           m_window;
   //--- Picture
   CPicture          m_picture1;
   
   //--- Main menu and its context menus
   CMenuBar          m_menubar;
   CContextMenu      m_mb_contextmenu1;

   //--- Drawing table
   //CCanvasTable m_canvas_table;
   
   //--- Status string
   CStatusBar        m_status_bar;

 
 

 
EasyAndFastGUI - библиотека для создания графических интерфейсов
EasyAndFastGUI - библиотека для создания графических интерфейсов
  • www.mql5.com
Библиотека EasyAndFastGUI дает возможность создавать графические интерфейсы для своих MQL-программ.
 
Yuriy Zaytsev:

In the latest release - https://www.mql5.com/en/code/19703

fails to add

The problem seems to be that I'm looking at examples in older versions!


I got Build 10 version , https://www.mql5.com/en/articles/3042 works there!

I had to do something like this, which is not good.

MQL5\Include\EasyAndFastGUI_B10

MQL5\Include\EasyAndFastGUI_B16

Графические интерфейсы X: Обновления для нарисованной таблицы и оптимизация кода (build 10)
Графические интерфейсы X: Обновления для нарисованной таблицы и оптимизация кода (build 10)
  • www.mql5.com
О том, для чего предназначена эта библиотека, более подробно можно прочитать в самой первой статье: Графические интерфейсы I: Подготовка структуры библиотеки (Глава 1). В конце статей каждой части представлен список глав со ссылками. Там же есть возможность загрузить к себе на компьютер полную версию библиотеки на текущей стадии разработки...
 

Wonderful library!

I made a simple but useful indicator for MICEX.

Share, % growth for the day, then the standard data, volumes to buy from the beginning of the day BuyVol, volumes to sell SellVol, VolDelta difference in volumes from the beginning of the day, I will finish the % of the current difference in volumes.

green delta - it is desirable to hold the buy, or try to look for a buy entry point, etc.



 
Yuriy Zaytsev:

Got Build 10 version , https://www.mql5.com/en/articles/3042 works there!

I had to do something like this, which is not good.

MQL5\Include\EasyAndFastGUI_B10

MQL5\Include\EasyAndFastGUI_B16.

Thanks for the message. I don't have time at the moment. I will see a little later what the problem might be.

 
Yuriy Zaytsev:

Got Build 10 version , https://www.mql5.com/en/articles/3042 works there!

I had to do something like this, which is not good.

MQL5\Include\EasyAndFastGUI_B10

MQL5/Include/EasyAndFastGUI_B16

Once the library was very much redesigned, I don't remember the build number. Most likely there is no CCanvasTable in new builds :)

In the conclusions in the articles there is a general scheme of the library at the time of release, you can compare.

 
hello

Is it not possible to colour a column using the table function?


If you add two indicators.

The close window function closes two windows.
The collect window function collects two windows.
Thank you very much for your help.

I am from Brazil, I used a translator to write. I apologise for any error in this language.


 
Hello friends
I have made the following changes

In the Table.mqh file

      string            m_header_text;    // Column header text
      color             m_header_color;   // Column header text colour //André
      CTCell            m_rows[];         // Array of the table rows

----------------------------------------------------------------------------------------------------------------------
   void              HeadersColorPressed(const color clr)    { m_headers_color_pressed=clr;      }
   //void HeadersTextColor(const colour clr){ m_headers_text_color=clr; } //André

----------------------------------------------------------------------------------------------------------
   void              SetHeaderText(const uint column_index,const string value);
   //--- Setting the colour text to the specified header //André
   void              HeadersTextColor(const color &array[]);
--------------------------------------------------------------------------------------------------------------------
//André 
//+------------------------------------------------------------------+
//| Fills the array of text alignment modes |
//+------------------------------------------------------------------+
void CTable::HeadersTextColor(const color &array[])
  {
   int total=0;
//--- Leave, if a zero-sized array was passed
   if((total=CheckArraySize(array))==WRONG_VALUE)
      return;
//--- Store the value into the array
   for(int c=0; c<total; c++)
      m_columns[c].m_header_color=array[c];
  }
------------------------------------------------------------------------------------------------------------------------
      //André
      //--- Text colour
      uint clr=::ColorToARGB(m_columns[c].m_header_color);

In Window.mqh file

//--- Handling the even of clicking the form buttons
   if(id==CHARTEVENT_CUSTOM+ON_CLICK_BUTTON)
     {
      //André
      if(StringFind(sparam, CElementBase::ProgramName(), 0)<0)
         return;
      //--- Close the window
-------------------------------------------------------------------------------
   int subwin=(CElementBase::ProgramType()==PROGRAM_INDICATOR)? ::ChartWindowFind() : m_subwin;
//--- Send a message about it
   //André
   //Print(__FUNCTION__, " " ", subwin, " ", PROGRAM_NAME);
   //::EventChartCustom(m_chart_id,ON_WINDOW_COLLAPSE,CElementBase::Id(),subwin,"");
   ::EventChartCustom(m_chart_id,ON_WINDOW_COLLAPSE,CElementBase::Id(),subwin, PROGRAM_NAME);
//--- Send a message about the change in the graphical interface
   ::EventChartCustom(m_chart_id,ON_CHANGE_GUI,CElementBase::Id(),0.0,"");
  }
---------------------------------------------------------------------------------------
   int subwin=(CElementBase::ProgramType()==PROGRAM_INDICATOR)? ::ChartWindowFind() : m_subwin;
//--- Send a message about it
   //André
   //::EventChartCustom(m_chart_id,ON_WINDOW_EXPAND,CElementBase::Id(),subwin,"");
   ::EventChartCustom(m_chart_id,ON_WINDOW_EXPAND,CElementBase::Id(),subwin,PROGRAM_NAME);
//--- Send a message about the change in the graphical interface
   ::EventChartCustom(m_chart_id,ON_CHANGE_GUI,CElementBase::Id(),0.0,"");

In WndEvents.mqh file.

      return(false);
//--- If the window identifier and the sub-window number match
   //André
   if(m_sparam!=m_windows[0].ProgramName()) 
      return(false);
   if(m_lparam==m_windows[0].Id() && (int)m_dparam==m_subwin)


I commented out the lines with my name to make localisation easier

Attached are the files with the modified full code.

I hope you have helped

Files:
WndEvents.mqh  144 kb
Window.mqh  129 kb
Table.mqh  304 kb