MQLで書かれたUIのギャラリー - ページ 44

 

フォーラムのメンバーの皆さんは、最新リリースにかなりの数のウィンドウがあることにお気づきかもしれない。

以下に列挙する:

1.すでにおなじみのデザイナーのタスクバー(Taskbar)。

2.コンストラクタのメインコンテキストメニュー(Main Menu)。

3.メインメニューから呼び出されるカスタム メニュー。

4.カスタムメニューから呼び出されるカスタムメニューウィンドウ(3つのウィンドウ:デモウィンドウ、設定ウィンドウ、ダイアログウィンドウ)。

5.5つの設定ウィンドウ:メインパラメーター、アカウント情報、入力パラメーター、設定例1、 設定例2

6.つのダイアログウィンドウ:危険な管理、誤った設定、1000ドル獲得、データの処理、変更の許可、申し訳ありませんが、この注文はブロックさ れます。


全部で17のウィンドウがある。

各ウィンドウに含まれる項目の数は異なる。最小は10個まで、最大は100個以上。しかし、それは限界ではない。ウィンドウの数は2倍、3倍と増やせる。コンストラクタを最大でテストしたことはないが、5倍のウィンドウ数に対応できることは確かだ。

しかし、もうひとつ言いたいことがある。多くのウィンドウをテンプレートとして使うことができる。まず、設定やメッセージのウィンドウだ。共通の構造を継承したり、一人または多数のプロジェクト間で受け渡すことができる。結局のところ、マークアップ・コードは非常にシンプルで、それをマージすることは難しくない。

では、デモ・プロジェクトは何から作られたのでしょうか?次のファイルをご覧ください。

#include<(2)  KIB PROJECTS\(6) DEMO PROJECTS\Demo project 1.mqh>        подключенный в (1) KIB-source v1.mq5.

そこに、このデモ・プロジェクトのすべてのウィンドウの KIB コードがあります。

各ウィンドウの コードは、理解したい人が理解できるように、個別に 示します。

 

メインコンテキストメニュー


//----------------------------------------------------------------------------------
NEW_WINDOW,  W_NAME, "Main context menu",    W_TYPE, MENU,   WINDOW_GROUP, MAIN_CONTEXT_MENU, 
//---------------------------------------------------------------------------------- 
 /**/ GROUP, "Menu items",
 //-----------------------------
 
__, M_ITEM, "MAIN MENU", POINTED,0, 
                       //-----------------------------
                       _,N_COLOR,(uint)C'240,240,240',
                       //-----------------------------
                       _,FONT_SIZE, 10, 
                       _,TEXT_STYLE, (int)FW_BOLD,
                       _,TEXT_FONT,"Arial_Black", 
                       _,text, N_COLOR,(uint)C'0,0,0',  
                       _,text, _A1_,_C2C, 
                       _,text, _C1_,-20, 
                       _,text, _A2_,_C2C,
                       
                       //-----------------------------
__, M_SEP,A, 
//---------------------------------------------------------------------------------- 
__, M_ITEM, "Bring window on top", TENURED,  _,PAR_TYPE,0, _,C_FUNCTION, BRING_WINDOW_ON_TOP,  _,N_LABEL,"::Images\\16x16\\Up.bmp", 
//----------------------------------------------------------------------------------
__, M_SEP,A, 
//----------------------------------------------------------------------------------
__,M_ITEM,"Standart Taskbar", OPENS_WINDOW, "Taskbar", _,N_COLOR, (uint)C'255,255,230', _,P_COLOR, (uint)C'255,255,220',_,NP_FRAME_COLOR, (uint)C'255,255,20',
//----------------------------------------------------------------------------------
 __, M_SEP,A, 
//---------------------------------------------------------------------------------- 
__,M_ITEM,"Custom Taskbar", _,N_COLOR, (uint)C'240,255,240', _,P_COLOR, (uint)C'230,255,230',_,NP_FRAME_COLOR, (uint)C'0,255,0',
//----------------------------------------------------------------------------------
 __, M_SEP,A, 
//----------------------------------------------------------------------------------
__,M_ITEM,"Custom Menu",   _,N_COLOR, (uint)C'240,240,255', _,P_COLOR, (uint)C'220,220,255',_,NP_FRAME_COLOR, (uint)C'120,120,255', 
//----------------------------------------------------------------------------------   
__, M_SEP,A,
//----------------------------------------------------------------------------------
Y_GAP,20, 
//----------------------------------------------------------------------------------
__, M_SEP,A, 
//----------------------------------------------------------------------------------
__, M_ITEM,"Sounds menu",
//----------------------------------------------------------------------------------
__, M_ITEM,"Color Picker",
//----------------------------------------------------------------------------------
__, M_ITEM,"Frames",
//----------------------------------------------------------------------------------
__, M_ITEM,"Fonts menu",
//----------------------------------------------------------------------------------
__, M_ITEM,"Icons", 
//----------------------------------------------------------------------------------
__, M_SEP,A, 
//----------------------------------------------------------------------------------
__, M_ITEM,"Save project and print the API file",C_FUNCTION, SAVE_PROJECT, 
//----------------------------------------------------------------------------------    
                  _,N_LABEL,"::Images\\16x16\\Save.bmp", 
//----------------------------------------------------------------------------------                  
                  _,N_COLOR, (uint)C'255,230,230', _,NP_FRAME_COLOR, (uint)C'255,70,70', 
//----------------------------------------------------------------------------------                  
                  _,P_COLOR, (uint)C'255,220,220', 
//----------------------------------------------------------------------------------
GAP,30,
//----------------------------------------------------------------------------------
__, M_SEP,A,
//----------------------------------------------------------------------------------
__, M_ITEM,"About the program",_,N_LABEL,"::Images\\16x16\\Help symbol.bmp",
//----------------------------------------------------------------------------------
END_GROUP,
//---------------------------------
i,AT, _X2X,"MF",3, _Y2Y,"MF",3,
//---------------------------------
i, TENURED, 
//----------------------------------------------------------------------------------
END_WINDOW, 
 

//-------------------------------------------------------------------- 
NEW_WINDOW,  
//-----------------------------
W_NAME, "Custom Menu",    
//-----------------------------
W_TYPE, MENU,   
//-----------------------------
WINDOW_GROUP, MAIN_CONTEXT_MENU,
//-----------------------------

//------------------------------------------------------------------- 
GROUP, "Menu items",
//-----------------------------
__, M_ITEM, "MY MENU", POINTED,0, 
                       //-----------------------------
                       _,FONT_SIZE, 9, 
                       _,TEXT_FONT,"Arial_Black", 
                       _,text, _A1_,_C2C, 
                       _,text, _C1_,-30, 
                       _,text, _A2_,_C2C,
                       _,text, _C2_,0, 
                       //-----------------------------
//-------------------------------------------------------------------------------
__, M_SEP,A, 
//-------------------------------------------------------------------------------
__, M_ITEM, "Bring window on top", TENURED,  _,PAR_TYPE,0, _,C_FUNCTION, 10000013,  _,N_LABEL,"::Images\\16x16\\Up.bmp", 
//-------------------------------------------------------------------------------
__, M_SEP,A, 
//-------------------------------------------------------------------------------
__, M_SEP,A, 
//-------------------------------------------------------------------------------
__, M_ITEM, "Show/Hide Taskbar", _,N_LABEL,"::Images\\16x16\\Toolbox.bmp", 
//-------------------------------------------------------------------------------

//-------------------------------------------------------------------------------
#include <(2) KIB PROJECTS\(1) Must be included\User section\My menu section.mqh> 
//-------------------------------------------------------------------------------
 END_GROUP,
 
//----------------------------------------------------------
//*DO NOT CHANGE GROUP POSITION-----------------------------
//----------------------------------------------------------
i, AT,_X2X,"MF",3, _Y2Y,"MF",3, 
//---------------------------------------------------------- 
END_WINDOW, 
//-------------------------------------------------------------------------------
 

//----------------------------------------------------------------------------------
NEW_WINDOW,  W_NAME, "Demo windows",    W_TYPE, MENU, 
//----------------------------------------------------------------------------------
 GROUP, "Menu items",
 //-----------------------------
 __, M_ITEM, "Settings windows",
//------------------------------ 
 __, M_ITEM, "Dialog windows",
 //-----------------------------
 END_GROUP,
//------------------------------
END_WINDOW,
//----------------------------------------------------------------------------------
 


//----------------------------------------------------------------------------------
NEW_WINDOW,  W_NAME, "Settings windows",    W_TYPE, MENU, 
//----------------------------------------------------------------------------------
 GROUP, "Menu items",
 //-----------------------------
 __, M_ITEM, "Main Parameters", 
//----------------------------- 
 __, M_ITEM, "Account info:", 
//----------------------------- 
 __, M_ITEM, "Input parameters:",
//----------------------------- 
 __, M_ITEM, "Settings example 1",
//----------------------------- 
 __, M_ITEM, "Settings example 2", 
//-----------------------------
 END_GROUP,
//-----------------------------
END_WINDOW,
//----------------------------------------------------------------------------------
 


//----------------------------------------------------------------------------------
NEW_WINDOW,  W_NAME, "Dialog windows", W_TYPE, MENU, 
//----------------------------------------------------------------------------------
GROUP, A,
//-----------------------------
 __, M_ITEM, "Risky managment!", 
//-----------------------------
 __, M_ITEM, "Incorrect settings", 
//-----------------------------
 __, M_ITEM, "Winning 1000$",   
//-----------------------------
 __, M_ITEM, "Processing the data...",   
//-----------------------------
 __, M_ITEM, "Allow changes",   
//-----------------------------
 __, M_ITEM, "Sorry, this order is blocked.",  
//-----------------------------
 END_GROUP,
//-----------------------------
END_WINDOW,
//----------------------------------------------------------------------------------
 



//DECLARE A NEW WINDOW
//----------------------------------------------------------------------------------
NEW_WINDOW,  
//------------------------------------------------------
/*SET WINDOW TYPE*/         W_TYPE, SETTINGS,  
//------------------------------------------------------
/*WRITE WINDOW'S NAME*/     W_NAME, "Settings example 1",
//------------------------------------------------------
/*POINT TO WINDOW'S ICON*/  W_ICON, "::Images\\16x16\\Wrench.bmp",  
//------------------------------------------------------

//------------------------------------------------------
/*SET WINDOW'S ADDITIONAL PROPERTIES*/   
//----------------------------------------------------------------------------------
/*WINDOW OPENS AT START*/   //OPEN_ON_INIT,  /*(OOI)*/

/*MARGINS OF THE WINDOW*/   MARGINS, 20,20,/*Х, Y*/
//----------------------------------------------------------------------------------

//----------------------------------------------------------------------------------
GROUP, A,
//----------------------------------------------------------------------------------------------------------
__,  BUTTON,"Start",                 PARAM_TYPE,   _BOOL,  _,A_TEXT, "Stop",   _,FIC,  GAP, 75,                                 
//----------------------------------------------------------------------------------------------------------
     CHECKBOX,"Set an option",       A_TEXT, "Option is set",                   BREAK_ROW_LINE,
//----------------------------------------------------------------------------------------------------------
GAP, 20,
//----------------------------------------------------------------------------------------------------------
__, CHECKBOX, "Set another option",              D_LIST, "D_LIST 1",  W,150,   BREAK_ROW_LINE,
//----------------------------------------------------------------------------------------------------------
GAP, 20,
//----------------------------------------------------------------------------------------------------------
__, CHECKBOX, "And another option",              C_LIST, "C_LIST 1",  W,150,   BREAK_ROW_LINE,
//----------------------------------------------------------------------------------------------------------
GAP, 50,
//---------------------------------------------------------------------------------------------------------- 
  
//----------------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------
__,  BOARD, "Spin the value ",   GAP, 100,  BOARD, "Roll the value ",
//----------------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------
__,  S_EDIT,"Spin the value",             V_STEP,1.7,
                                         //-------------------
                                         _,VALUE_TYPE, _DOUBLE,  
                                         //-------------------  
                                         _,READ_ONLY,
                                         //------------------- 
                                         _,DIGITS,3,                
//---------------------------------------------------------------------------------------------------------- 
     H_SLIDER,"Roll the value",          
                                         W,170,
                                         //-------------------
                                         _,V_CURRENT,  35, 
                                         //-------------------
                                         _,V_MIN,    0,  
                                         //-------------------
                                         _,V_MAX,    100,  
                                         //-------------------
                                         _,V_STEP,   1,   
                                         //-------------------
                                         _,SHOW_WIDGET, WIDGET_ON_TOP, 
                                         //-------------------
                                         BREAK_ROW_LINE,
                                         //-------------------
END_GROUP,
//----------------------------------------------------------------------------------------------------------
i, AT, _X2X, "MF", 20, _Y2Y, "MF", 30,
//---------------------------------------
i, X_GAP, 55,
i, Y_GAP, 10,
//---------------------------------------
SWITCH, "R_BUTTON 1",   "R_BUTTON 2", END,
//---------------------------------------
SWITCH, "_BUTTON 1",   "_BUTTON 2", END,
//------------------------------------------------------ 
GROUP, A,
__,L_ITEM, "L_ITEM  1",ON,
__,L_ITEM, "L_ITEM  2",
__,L_ITEM, "L_ITEM  3",
__,L_ITEM, "L_ITEM  4",
__,L_ITEM, "L_ITEM  5",
__,L_ITEM, "L_ITEM  6",
__,L_ITEM, "L_ITEM  7",
__,L_ITEM, "L_ITEM  8",
__,L_ITEM, "L_ITEM  9",
__,L_ITEM, "L_ITEM  10",
__,L_ITEM, "L_ITEM  11",
__,L_ITEM, "L_ITEM  12",
__,L_ITEM, "L_ITEM  13",
__,L_ITEM, "L_ITEM  14",
__,L_ITEM, "L_ITEM  16",
__,L_ITEM, "L_ITEM  17",
__,L_ITEM, "L_ITEM  18",
__,L_ITEM, "L_ITEM  19",
__,L_ITEM, "L_ITEM  20",

END_GROUP,
//-------------------------
i, AT, LEFT_TOP, 0,0,
i, IN,"D_LIST 1",
//----------------------------------------------------------------------------------

//----------------------------------------------------------------------------------
GROUP, "V2 group",

__, L_ITEM,"Times_New_Roman",
__, L_ITEM,"Arial",
__, L_ITEM,"Tahoma",
__, L_ITEM,"Dali",
__, L_ITEM,"BatangChe",
__, L_ITEM,"Consolas",
__, L_ITEM,"Courier",
__, L_ITEM,"Courier_New",ON,
__, L_ITEM,"DFKai_SB",
__, L_ITEM,"DotumChe",
__, L_ITEM,"FangSong",
__, L_ITEM,"Fixedsys",
__, L_ITEM,"GulimChe",
__, L_ITEM,"GungsuhChe",
__, L_ITEM,"KaiTi",

END_GROUP,
//------------------
i, IN,"C_LIST 1",
//------------------
i, AT, LEFT_TOP, 1,1,
//----------------------------------------------------------------------------------


GROUP, A,
//----------------------------------------------------------------------------------------------------------
__, CHECKBOX, "Don't show this dialog", GAP, 50, D_BUTTON, "Apply", N_FRAME_COLOR, (int)C'51,153,255', _,CWIP, GAP,7,  D_BUTTON, "Close", _,CWIP, BREAK_ROW_LINE,
//---------------------------------------------------------------------------------------------------------- 
END_GROUP,
//--------------------------
i, AT, _X2X, "MF", 20, _Y2H, "Roll the value",  20,
//----------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------------------+
GROUP,A,__, G_FRAME,"Group frame 1", ON_TOP,"Start",   R_SIDE, "Set an option",  B_SIDE,"C_LIST 1", END_GROUP,
//--------------------------------------------------------------------------------------------------+
//--------------------------------------------------------------------------------------------------+
GROUP,A,__, G_FRAME,"Group frame 2", ON_TOP,"Spin the value ",  R_SIDE, "Roll the value",  B_SIDE,"Roll the value",END_GROUP,
//--------------------------------------------------------------------------------------------------+
//------------------------------------------------------
//FINISH THE WINDOW BY KEYWORDS END_WINDOW,
//------------------------------------------------------
END_WINDOW,
//----------------------------------------------------------------------------------
 
続きはもう少し後で。
 
私の操作の問題かどうかはわかりませんが、gifをアップロードしました。ただ、報告しておきます。
 
hini #:
私のOSの問題かどうかはわかりませんが、gifをダウンロードしました。ただ、報告しておきます。
ご報告ありがとうございます。チャートのサイズを変更するオプションは試していません。OnChartEvent()のイベントを確認してみます。