//+------------------------------------------------------------------+ //| eIncGUI_v3_Test_Form.mq5 | //| Copyright 2011, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2011, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #include "IncGUI_v3.mqh" //#include //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ enum eColorScheme{ DefaultScheme=0, YellowBrownScheme=1, BlueScheme=2, GreenScheme=3, YellowBlackScheme=4, LimeBlackScheme=5, AquaBlackScheme=6 }; input eColorScheme ColorScheme=DefaultScheme; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class CForm: public CFormBase{ public: // 1. Declaring the controls CHMenu m_hm; CVMenu m_vm1; CVMenu m_vm2; CVMenu m_vm3; CFrame m_fr1; CFrame m_fr2; CInputBox m_ib; CSpinInputBox m_sib; CDialerInputBox m_dib; CComBox m_cb; CCheckBox m_chb; CRadioGroup m_rg1; CRadioGroup m_rg2; CListMS m_lms1; CListMS m_lms2; CButton m_but; protected: // 2. Declaring the variables to restore the control values int m_EventsCounter; void MainProperties(){ // Setting the form parameters m_Name = "Form"; // Form name. The names of all the controls should start with it. m_Width = 260; // Form width m_Height = 200; // Form height m_Type = 0; // Form type: 0 - without buttons, 1 - with "Apply" and "Cancel" buttons, 2 - with the "Close" button m_Caption = "FormCaption"; // Form caption m_Movable = false; // Movable form (the button with a hand image is displayed in the top left corner) m_Resizable = true; // Form minimizing/maximizing allowed (the button with a rectangle image is displayed in the top right corner) m_CloseButton = true; // Form closing allowed (the button with a cross image is displayed in the top right corner) } void OnInitEvent(){ // 3. Calling the Init() methods of all the controls // 4. Loading the parameters from the data storage, where necessary // 5. Preparation of the controls, for example adding the list items. // Menu components // Horizontal menu m_hm.Init(m_Name+"_HM",m_Width,2); // Adding horizontal menu items m_hm.AddItem("Form types"); m_hm.AddItem("Item-2"); m_hm.AddItem("Item-3"); // Vertical menu 1 m_vm1.Init(m_Name+"_VM1",70,10); // Adding items to vertical menu 1 m_vm1.AddItem("Type-1"); m_vm1.AddItem("Type-2"); // Vertical menu 2 m_vm2.Init(m_Name+"_VM2",70,3); // Adding items to vertical menu 2 m_vm2.AddItem("Item-2-1"); m_vm2.AddItem("Item-2-2"); m_vm2.AddItem("Item-2-3"); m_vm2.AddItem("Item-2-4"); m_vm2.AddItem("Item-2-5"); // Vertical menu 3 m_vm3.Init(m_Name+"_VM3",70,3); // Adding items to vertical menu 3 m_vm3.AddItem("Item-3-1"); m_vm3.AddItem("Item-3-2"); m_vm3.AddItem("Item-3-3"); m_vm3.AddItem("Item-3-4"); m_vm3.AddItem("Item-3-5"); // Frames m_fr1.Init(m_Name+"_Frame1",120,155,"Frame-1",38); m_fr2.Init(m_Name+"_Frame2",120,155,"Frame-2",38); // Components m_ib.Init(m_Name+"_IB",40,2); m_sib.Init(m_Name+"_SIB",40,1); m_dib.Init(m_Name+"_DIB",40,2); m_cb.Init(m_Name,40); m_cb.AddItem("1"); m_cb.AddItem("2"); m_cb.AddItem("3"); m_cb.AddItem("4"); m_cb.AddItem("5"); m_cb.SetSelectedIndex(0); m_chb.Init(m_Name+"CB"); m_rg1.Init(m_Name+"_RG1"); m_rg1.AddButton("11",0,0); m_rg1.AddButton("12",0,20); m_rg1.AddButton("13",25,0); m_rg1.AddButton("14",25,20); m_rg1.SetValue(0); m_rg2.Init(m_Name+"_RG2"); m_rg2.AddButton("21",0,0); m_rg2.AddButton("22",0,20); m_rg2.AddButton("23",25,0); m_rg2.AddButton("24",25,20); m_rg2.SetValue(0); m_lms1.Init(m_Name+"_ListMS1",105,4); for(int i=0;i=0){ // Event of the vertical menu 1 m_vm1.Hide(); // Hiding the menu if(m_event1==0){ // Clicking item 0 frm2.Hide(); frm1.Show(frm.Left()+100,frm.Top()+100); } if(m_event1==1){ // Clicking item 1 frm1.Hide(); frm2.Show(frm.Left()+100,frm.Top()+100); } } if(m_event2>=0){ m_vm2.Hide(); Alert("Menu item selected "+m_vm2.Text(m_event2)); } if(m_event3>=0){ m_vm3.Hide(); Alert("Menu item selected "+m_vm3.Text(m_event3)); } // Events of other controls if(m_ib.Event(id,lparam,dparam,sparam)>0){ Alert("Input event"); } if(m_sib.Event(id,lparam,dparam,sparam)>0){ Alert("SpinInput event"); } if(m_dib.Event(id,lparam,dparam,sparam)>0){ Alert("DialerInput event"); } if(m_cb.Event(id,lparam,dparam,sparam)>0){ Alert("ComBox event"); } if(m_rg1.Event(id,lparam,dparam,sparam)>0){ Alert("RadioGroup-1 event"); } if(m_rg2.Event(id,lparam,dparam,sparam)>0){ Alert("RadioGroup-2 event"); } if(m_chb.Event(id,lparam,dparam,sparam)>0){ Alert("CheckBox event"); } m_lms1.Event(id,lparam,dparam,sparam); m_lms2.Event(id,lparam,dparam,sparam); if(m_but.Event(id,lparam,dparam,sparam)==1){ if(m_lms1.FirstSelected()==-1 && m_lms2.Count()==0){ Alert("No selected items in symbol list"); } else{ m_lms2.Clear(); for(int i=0;i