Libraries: EasyAndFastGUI library for creating graphical interfaces - page 22

 

Hi colleagues!

I managed to reduce the number of warrnings from 18 to 6 by replacing the object name with "CElementBase::".

And those 6 are reduced to 4 types of errors, which I give below. Please help me to fence them correctly.

1. How to correctly replace "m_tabs.GetButtonPointer(m_selected_tab)." with the text "CElementBase::"?

//--- Define the colour for the line
   color clr=m_back_color;
   if(m_tabs.GetButtonPointer(m_selected_tab).IsLocked()) // this one!
      clr=m_tabs.GetButtonPointer(m_selected_tab).BackColorLocked();
//--- Draw a line
   m_canvas.Line(x1,y1,x2,y2,::ColorToARGB(clr,m_alpha));
  }


2. And here - when I replace "el." with "CElementBase::". - there is a new compilation error "IsAvailable - access to non-staticmember of function" - how to fix this varning correctly?

      for(int e=0; e<elements_total; e++)
        {
         //--- Check only available items
         CElement *el=m_wnd[m_active_window_index].m_elements[e];
         if(!el.IsVisible() || !el.IsAvailable() || el.IsLocked())
            continue;
         //--- Event handling in the item handler
         el.OnEvent(m_id,m_lparam,m_dparam,m_sparam);
        }


3. the same line: when I replace "el.IsLocked()" with the text "CElementBase::IsLocked" : error "IsLocked - access to non-static member of function".

4. and lastly - what is the correct way to replace "m_windows[0].IsLocked()"?

//--- Exit if the interface is not created
   if(windows_total<1)
      return;
//--- Resize all elements of the locked form if one of the modes is enabled
   if(m_windows[0].IsLocked() && (m_windows[0].AutoXResizeMode() || m_windows[0].AutoXResizeMode()))
     {

It would be great to use this library, but I need to solve these problems first.


Thanks in advance!

Documentation on MQL5: Language Basics / Object-Oriented Programming / Static Members of a Class
Documentation on MQL5: Language Basics / Object-Oriented Programming / Static Members of a Class
  • www.mql5.com
Static Members of a Class - Object-Oriented Programming - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Yevgen Drumachyk:

Hello, colleagues!

I was able to reduce the number of warrnings from 18 to 6 by replacing the object name with "CElementBase::".

el.CElementBase::IsLocked() ?
 
Edgar Akhmadeev:
el.CElementBase::IsLocked() ?

Edgar Akhmadeev, thank you very much, Colleague!

It worked! ))

 

Greetings, colleagues!

Can you please tell me how to create two windows using this library? I am writing an Expert Advisor that consists of two windows: 1) trading panel, and 2) Watch List.

The first window with the trading panel is created and works without problems:

CWindow m_window;

CreateWindow(m_window, "META TOOLS",1,1,175,175,200,false,false,true,true) + adding buttons:


But when adding:

CWindow m_watchlist_window;

CreateWindow(m_watchlist_window, "Watch List",150,1,100,100,150,false,false,true,true,false)

CreateButton(m_watchlist1_btn, "EURUSD",m_watchlist_window,0,245,25,60,30)

then the EURUSD button appears in the air... i.e. another separate window is not created... why?



This UI is created in the context: class CProgram : public CWndCreate

I complete the creation of the UI with the command

CWndEvents::CompletedGUI()


Could you please tell me if you managed to create a multi-window UI?

I'm talking about two independent windows. I.e. the variant with appearing dialogue window (like for settings) is not suitable. You need both windows to be always visible and independently clickable. Why separate windows? Because the first one - Trade Panel - is a fixed size. The second - Watch List - the size of the window changes as the number of items added to it is added or reduced.

 

Hi guys!

Have you been able to create more than 1 independent window using this library? That is to call WindowCreate() method more than once to additional windows on the chart within same EA? 

I can successfully create 1 window. But then when trying to create the 2nd one - it does NOT appear...

Any ideas why? 

Or, an example, how did you manage to create additional windows (not dialogs). 

Thanks!

 
Yevgen Drumachyk:

Could you please tell me how to create two windows using this library?


You can't. Everything is built around one main window. One of the reasons why I started writing my own library )

 
Oleksii Chepurnyi:

No way. Everything is built around one main window. One of the reasons why I started writing my own library )

Thanks, Oleksii Chepurnyi! I would like to do without this library after all. It is very well done.


Guys, any other versions? Maybe someone bypassed this problem and managed to create more than 1 window?

You can see in the library code that a newly created window is added to the "common array of elements". So there can be more windows than one...? Pay attention to this piece of code in the library:



//+------------------------------------------------------------------+
//| Adds the window pointer to the interface element database |
//+------------------------------------------------------------------+
void CWndContainer::AddWindow(CWindow &object)
  {
   int windows_total=::ArraySize(m_windows);
//--- If there are no windows yet, reset the element counter to zero
   if(windows_total<1)
     {
      m_counter_element_id=0;
      ::Comment("Loading. Please wait...");
     }
//--- Add a pointer to the windows array
   int new_size=windows_total+1;
   ::ArrayResize(m_wnd,new_size);
   ::ArrayResize(m_windows,new_size);
   m_windows[windows_total]=::GetPointer(object);
//--- Add a pointer to the common array of elements
   int last_index=ResizeArray(m_wnd[windows_total].m_elements);
   m_wnd[windows_total].m_elements[last_index]=::GetPointer(object);
//--- Add window button pointers to the database
   AddWindowElements(windows_total,object);
//--- Set the id and remember the id of the last element
   m_windows[windows_total].Id(m_counter_element_id);
   m_windows[windows_total].LastId(m_counter_element_id);
//--- Increase the counter of element identifiers
   m_counter_element_id++;
  }
 
To start two windows and make them active at the same time, you need to edit the library. Not a simple and voluminous task. If you need it very much, write to freelance
 
The best, ever. Congrats.
 

Hello everyone, how are you? Is there a limit to CreateSimpleButton? I am not able to put more than 6 simple buttons on the window. I am using the code of the graphical interfaces x (mql4). I had the uninit reason 8. I am very grateful to Anatoli Kazharski Best, RDT


I found out that the error was with the metatrader 4 itself, I was compiling the EA on the same chart several times. I noticed that if I make the changes and close the graph and open a new one and then put the EA in it, the changes are applied correctly. Anatoli, thank you very much for all the exceptional and complete work. Best, RDT

Anatoli Kazharski
Anatoli Kazharski
  • 2019.02.17
  • www.mql5.com
Perfil do Trader