Discussion of article "Graphical Interfaces XI: Rendered controls (build 14.2)"

 

New article Graphical Interfaces XI: Rendered controls (build 14.2) has been published:

In the new version of the library, all controls will be drawn on separate graphical objects of the OBJ_BITMAP_LABEL type. We will also continue to describe the optimization of code: changes in the core classes of the library will be discussed.

Below is the appearance of the different types of buttons:

 Fig. 9. Demonstration of the appearance of several button types.

Fig. 9. Demonstration of the appearance of several button types.

Author: Anatoli Kazharski

 

Hi, The set of controls is really nice and helpful, but it would be even better if you can handle higher DPI setting in a better way.

Obviously, the bitmaps will display correctly, but the text does not. It gets shifted down and clipped as shown on the image below:

I use the following display settings :


 
Artur Zas:

Hi, The set of controls is really nice and helpful, but it would be even better if you can handle higher DPI setting in a better way.

Obviously, the bitmaps will display correctly, but the text does not. It gets shifted down and clipped as shown on the image below:

I use the following display settings :


 
Facundo Laje:
Hi, could.it be used with MT4?

 
Facundo Laje:
Hi, could.it be used with MT4?

Technically speaking it should as OBJ-BITMAP_LABEL is also available in MQL4, but you would need to adjust the library code as there are a few places where the code will just not compile using the MQL4 compiler.

I'll try to play around with the library and I'll let you know, if I'm able to somehow port it to MQL4. You can also try by yourself. Just rename the example EA's .mq5 extension to .mq4 and try to compile the code.

Obviously, you will get compilation errors however you can check where and what they are. 

 

Hi,

I'm trying to develop my own control panel following this article series... I'm interested in the multi-windows mode part(Article04) but I used the updated Library14(Article10).

What I got so far(in the attached pics):


image1

image2

What did I missed because  the window2 and window3 are not moving, not closing when hit the close buttons and colapse button it's missing..

Here is the code parts of windows 2 and 3:

 

//-------- Window2-------
#resource "\\Images\\EasyAndFastGUI\\Icons\\bmp16\\color_picker.bmp"
bool CmyPanel_Test2::CreateWindow2(const string caption_text)
  {
//--- Store the window pointer
   CWndContainer::AddWindow(m_window2);
    m_window2.MainPointer(m_mb_contextmenu1);
//--- Coordinates
   int x =(m_window2.X()>0) ? m_window2.X() : 100;
   int y =(m_window2.Y()>0) ? m_window2.Y() : 100;
//--- Properties
   m_window2.Movable(true);
   m_window2.Alpha(200);
   m_window2.XSize(300);
   m_window2.YSize(100);
   m_window2.IconXGap(3);
   m_window2.IconYGap(2);
   m_window2.WindowType(W_DIALOG);
   m_window2.CloseButtonIsUsed(true);
   m_window2.GetCloseButtonPointer().Tooltip("Close");
   m_window2.GetCollapseButtonPointer().Tooltip("Collapse/Expand");
   m_window2.IconFile("Images\\EasyAndFastGUI\\Icons\\bmp16\\color_picker.bmp");
//--- Creating a form
   if(!m_window2.CreateWindow(m_chart_id,m_subwin,caption_text,x,y))
      return(false);
//---
   return(true);
  }
//------------------Window3----------------
bool CmyPanel_Test2::CreateWindow3(const string caption_text)
  {
//--- Store the window pointer
   CWndContainer::AddWindow(m_window3);
    m_window2.MainPointer(m_menubar);
//--- Coordinates
   int x =(m_window2.X()>0) ? m_window2.X() : 100;
   int y =(m_window2.Y()>0) ? m_window2.Y() : 100;
//--- Properties
   m_window3.Movable(true);
   m_window3.Alpha(200);
   m_window3.XSize(200);
   m_window3.YSize(200);
   m_window3.IconXGap(3);
   m_window3.IconYGap(2);
   m_window3.WindowType(W_DIALOG);
   m_window3.CloseButtonIsUsed(true);
   m_window3.GetCloseButtonPointer().Tooltip("Close");
   m_window3.GetCollapseButtonPointer().Tooltip("Collapse/Expand");
   m_window3.IconFile("Images\\EasyAndFastGUI\\Icons\\bmp16\\color_picker.bmp");
//--- Creating a form
   if(!m_window3.CreateWindow(m_chart_id,m_subwin,caption_text,x,y))
      return(false);
//---
   return(true);
  }

and the OnEvent part:

void CmyPanel_Test2::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {

   if(id==CHARTEVENT_CUSTOM+ON_CLICK_MENU_ITEM)
     {
      PRINT_EVENT(ON_CLICK_MENU_ITEM,id,lparam,dparam,sparam);
      return;
     }
//---
   if(id==CHARTEVENT_CUSTOM+ON_CLICK_BUTTON)
     {
     PRINT_EVENT(ON_CLICK_BUTTON,id,lparam,dparam,sparam);
     
     if(lparam==1 && dparam==1)
     {
      m_window3.Show();
      return;
     }
      return;
     }
//---
   if(id==CHARTEVENT_CUSTOM+ON_CLICK_CONTEXTMENU_ITEM)
     {
      if (dparam==0)
      m_window2.Show();
      PRINT_EVENT(ON_CLICK_CONTEXTMENU_ITEM,id,lparam,dparam,sparam);
      return;
     }

Thank you.

 
zlory73:

Hi,

I'm trying to develop my own control panel following this article series... I'm interested in the multi-windows mode part(Article04) but I used the updated Library14(Article10).

What I got so far(in the attached pics):


What did I missed because  the window2 and window3 are not moving, not closing when hit the close buttons and colapse button it's missing..

Here is the code parts of windows 2 and 3:

 

and the OnEvent part:

Thank you.


Sorry, modified:

bool CmyPanel_Test2::CreateWindow3(const string caption_text)
  {
//--- Store the window pointer
   CWndContainer::AddWindow(m_window3);
    m_window3.MainPointer(m_window);

and:

bool CmyPanel_Test2::CreateWindow2(const string caption_text)
  {
//--- Store the window pointer
   CWndContainer::AddWindow(m_window2);
    m_window2.MainPointer(m_window);

still nothing...

Please help1

 
Artur Zas:

Technically speaking it should as OBJ-BITMAP_LABEL is also available in MQL4, but you would need to adjust the library code as there are a few places where the code will just not compile using the MQL4 compiler.

I'll try to play around with the library and I'll let you know, if I'm able to somehow port it to MQL4. You can also try by yourself. Just rename the example EA's .mq5 extension to .mq4 and try to compile the code.

Obviously, you will get compilation errors however you can check where and what they are. 

 
Facundo Laje:
Thanks
 
zlory73:

Sorry, modified:

and:

still nothing...

Please help1


Hello,

Solved those issues using the OpenWindow()  funcion in stead of  Show() function, and now I got the collapse button activated too..

Now I'd like to add some controls to the window2 and window3 like buttons and checkboxes but I got some error like in the following picture:

I do not bother so much for the reading image errors... Only for the pointer access.. the error is from the line:

CWndContainer::AddToElementsArray(1,m_checkbox1);

I think the window_index should be 0 for the main, 1 for the window2, 2 for the window3 right?

Using one of previous library(article06) had no issues  with adding controls to a subwindow.

Now the code for adding controls:

//------------------CheckBox---------------
  bool CmyPanel_Test2::CreateCheckBox1(const int x_gap,const int y_gap,string text)
  {
//--- Store the pointer to the main control
   m_checkbox1.MainPointer(m_window2);
//--- Set properties before creation
   m_checkbox1.XSize(40);
   m_checkbox1.YSize(20);
   m_checkbox1.IsPressed(false);

//--- Create a control
   if(!m_checkbox1.CreateCheckBox("box1",x_gap,y_gap))
      return(false);
//--- Add the object to the common array of object groups
    CWndContainer::AddToElementsArray(1,m_checkbox1);
   return(true);
  }
//---------------Button----------  
  bool CmyPanel_Test2::CreateIconButton1(const int x_gap,const int y_gap,const string text)
  {
//--- Store the pointer to the main control
   m_icon_button1.MainPointer(m_window2);
//--- Properties
   m_icon_button1.XSize(115);
   m_icon_button1.YSize(22);
   m_icon_button1.IconXGap(3);
   m_icon_button1.IconYGap(3);
   m_icon_button1.TwoState(true);
   m_icon_button1.IconFile("Images\\EasyAndFastGUI\\Icons\\bmp16\\stop.bmp");
   m_icon_button1.IconFileLocked("Images\\EasyAndFastGUI\\Icons\\bmp16\\stop_gray.bmp");
   m_icon_button1.IconFilePressed("Images\\EasyAndFastGUI\\Icons\\bmp16\\start.bmp");
   m_icon_button1.IconFilePressedLocked("Images\\EasyAndFastGUI\\Icons\\bmp16\\start_gray.bmp");
//--- Create a control
   if(!m_icon_button1.CreateButton(text,x_gap,y_gap))
      return(false);
//--- Add the pointer to control to the base
   CWndContainer::AddToElementsArray(1,m_icon_button1);
   return(true);
  }

Please anyone can help, thanks...


PS:I hope not beeing annoying with my threads. Have a nice day.

 
Artur Zas:

Hi, The set of controls is really nice and helpful, but it would be even better if you can handle higher DPI setting in a better way.

Obviously, the bitmaps will display correctly, but the text does not. ...


I would say the text is scaled properly, unlike all the rest of the graphics.

Reason: