ライブラリ: EasyAndFastGUIグラフィックインターフェース作成ライブラリ - ページ 15

 
ビジュアル・フォーム・デザイナーの 計画はありますか?
 
Anatoli Kazharski

このバージョンのライブラリを使ってダイアログウィンドウを開く方法はありますか?ダイアログウィンドウはカラーピッカーのみで動作し、テーブルや追加ボタンを挿入するために空白のダイアログウィンドウを作成しようとすると、まったく動作しません。

これは本当に美しいライブラリで、共有してくれてありがとうございます。

単一のウィンドウを使用する場合は、すべてが正常に動作している唯一のダイアログウィンドウが動作していない、またはこれは最初から計画されていた?)


PS

もし私が間違っていたら、ダイアログウィンドウを開き、中にボタンを1つだけ表示させるか、何か他のもの(カラーピッカー以外)を表示させる方法の例はありますか?

MT5を使用しています。

 
Farrukh Aleem:

MT4バージョンの SimpleButtonには、ボタンのテキスト/キャプションを変更する機能が ありません。


シンプルボタン.mqh

2行目を追加してください。必要な人の役に立てば幸いです。

この記事のライブラリはMT5専用です:

lableClassDeclarationName.LabelText(textValue);
lableClassDeclarationName.Update(true);
 
Stanislav Korotky:
ビジュアル・フォーム・デザイナーの計画はありますか?

以前は考えていましたが、残念ながらまだ時間がありません。

ライブラリの新バージョンは近々リリースされる予定です。GUIの作成がより簡単で速くなるでしょう。その後、ビジュアル・エディターを作ろうと思っています。

 
Marcin Rutkowski:

このバージョンのライブラリを使ってダイアログウィンドウを開く方法はありますか?ダイアログウィンドウはカラーピッカーのみで動作しており、テーブルや追加ボタンを挿入するために空白のダイアログウィンドウを作成しようとすると、まったく動作しません。

これは本当に美しいライブラリで、共有していただきありがとうございます。

単一のウィンドウを使用する場合は、すべてOKですが、ダイアログウィンドウだけが正しく動作していない、またはこれは最初から計画されていた?)


PS

もし間違っていたら、ダイアログウィンドウを開き、中にボタンを1つだけ配置する方法とか、他の方法(カラーピッカー以外)の例はありますか?

MT5を使用しています。

こんにちは、Marcin、オブジェクト(ダイアログウィンドウを含む)を作成する関数を書いてください。例えば

まず、Program.mqhでダイアログウィンドウとその他のコントロール(ボタン、テキストボックス、チェックボックスなど)を宣言します:

class CProgram : public CWndEvents
  {
protected:
  
   
   CWindow           m_window;//メイン・ウィンドウ
   CWindow           s_window;//ダイアログ・サブウィンドウ
  
   CButton           m_ibut1;
   CButton           m_ibut2;
   CTextBox          t_box1;
   CCheckBox         m_checkb1;
....

MainWindow.mqhで宣言する:

   //--メインウィンドウの機能:
 bool CProgram::CreateWindow(const string caption_text)
  {
//--- ウィンドウ配列にウィンドウ・ポインタを追加する。
   CWndContainer::AddWindow(m_window);
//--- 座標
   int x=(m_window.X()>0) ? m_window.X() : 20;
   int y=(m_window.Y()>0) ? m_window.Y() : 30;
//--- プロパティ
   m_window.XSize(253);
   m_window.YSize(350);
   m_window.IsMovable(true);
   m_window.Alpha(200);
   m_window.IconXGap(3);
   m_window.IconYGap(2);
   m_window.WindowType(W_MAIN);
   m_window.CloseButtonIsUsed(true);
   m_window.CollapseButtonIsUsed(true);
   m_window.TooltipsButtonIsUsed(false);
//--- ツールチップを設定する
   m_window.GetCloseButtonPointer().Tooltip("Close");
   m_window.GetCollapseButtonPointer().Tooltip("Collapse/Expand");
  // m_window.GetTooltipButtonPointer().Tooltip("Tooltips");
//--- フォームの作成
   if(!m_window.CreateWindow(m_chart_id,m_subwin,caption_text,x,y))
      return(false);
//---
   return(true);
  }
 //----ダイアログ(サブウィンドウ)の場合: 
bool CProgram::CreateSubWindow(CWindow &win,const int xSize,const int ySize,const string caption_text)
  {
//--- ウィンドウ配列にウィンドウ・ポインタを追加する。
   CWndContainer::AddWindow(win);
//--- 座標
   int x=(win.X()>0) ? win.X() : 150;
   int y=(win.Y()>0) ? win.Y() : 70;
//--- プロパティ
   win.XSize(xSize);//350
   win.YSize(ySize);//170
   win.IsMovable(true);
   win.Alpha(200);
   win.IconXGap(3);
   win.IconYGap(2);
   win.WindowType(W_DIALOG);
   win.CloseButtonIsUsed(true);
   win.CollapseButtonIsUsed(true);
   win.TooltipsButtonIsUsed(false);
 
 // m_window.IconFile("¦Images¦EasyAndFastGUI¦Icons¦bmp16¦advisor.bmp");
//--- ツールチップを設定する
   win.GetCloseButtonPointer().Tooltip("Close");
   win.GetCollapseButtonPointer().Tooltip("Collapse/Expand");
  // m_window.GetTooltipButtonPointer().Tooltip("Tooltips");
//--- フォームの作成
   if(!win.CreateWindow(m_chart_id,m_subwin,caption_text,x,y))
      return(false);
//---
   return(true);
  }  
他のコントロール(ボタン、テキストボックス...)には、メインポインタ(ウィンドウまたはタブ)とそのインデックス(私の場合は "windex")を最初から使う:
bool CProgram::CreateTextBox(CTextBox &t_box,CWindow &win,const int windex,const int x_gap,const int y_gap,const int Xsize,const int Ysize,
                                          string text,const uint line_index,const int fontSize,const bool mlinemode)
  {
       t_box.MainPointer(win);
 
//--- プロパティ
   t_box.XSize(Xsize);
   t_box.YSize(Ysize);
   t_box.FontSize(fontSize);
   t_box.Font("Calibri"); // コンソラ|カリブリ|タホマ
   t_box.TextYOffset(2);
   t_box.TextXOffset(2);
   t_box.BackColor(clrWhite);
   t_box.BorderColor(C'150,170,180');
   t_box.LabelColor(clrBlack);
   t_box.WordWrapMode(true);
   t_box.ReadOnlyMode(false);
   t_box.IsCenterText(true);
   t_box.MultiLineMode(mlinemode);
   t_box.AutoYResizeBottomOffset(3);
   t_box.AutoXResizeRightOffset(3);
   t_box.AddText(line_index,text);
   t_box.IsVisible(true);
//--- タブに貼り付ける
  // tab.AddToElementsArray(tindex,t_box);
//--- コントロールの作成
   if(!t_box.CreateTextBox(x_gap,y_gap))
      return(false);
//--- オブジェクト・グループの共通配列にオブジェクトを追加する。
   CWndContainer::AddToElementsArray(windex,t_box);
  return(true);
  } 
//----------勝利ボタン
bool CProgram::CreateIconButton(CButton &i_but,CWindow &win,const int windex,const int x_gap,const int y_gap,const int Xsize,const int Ysize,
                                              string text, bool twostate,color bckclr)
  {
//--- メイン・コントロールへのポインタを格納する。
   i_but.MainPointer(win);
//--- プロパティ
   i_but.XSize(Xsize);
   i_but.YSize(Ysize);
   i_but.IconXGap(3);
   i_but.IconYGap(3);
   i_but.TwoState(twostate);
   i_but.BackColor(bckclr);
   i_but.BorderColor(clrBlack);
   i_but.IsCenterText(true);
   i_but.IsPressed(false);
   if(i_but.TwoState()==true)
     {i_but.BackColorPressed(bckclr);
     i_but.BackColor(clrSilver);}
   else
     i_but.BackColor(bckclr);
//--- タブに貼り付ける
  // tab.AddToElementsArray(tindex,i_but);

//--- コントロールの作成
   if(!i_but.CreateButton(text,x_gap,y_gap))
      return(false);
//--- コントロールへのポインタをベースに追加する。
   CWndContainer::AddToElementsArray(windex,i_but);
   return(true);
  } 
//-----------tab button--------------
bool CProgram::CreatetabIconButton(CButton &i_but,CTabs &tab,const int tindex,const int x_gap,const int y_gap,const int Xsize,const int Ysize,
                                              string text, bool twostate,color bckclr)
  {
//--- メイン・コントロールへのポインタを格納する。
   i_but.MainPointer(tab);
//--- プロパティ
   i_but.XSize(Xsize);
   i_but.YSize(Ysize);
   i_but.IconXGap(3);
   i_but.IconYGap(3);
   i_but.TwoState(twostate);
   i_but.BackColor(bckclr);
   i_but.BorderColor(clrBlack);
   i_but.IsCenterText(true);
   i_but.IsPressed(false);
   if(i_but.TwoState()==true)
     {i_but.BackColorPressed(bckclr);
     i_but.BackColor(clrSilver);}
   else
     i_but.BackColor(bckclr);
//--- タブに貼り付ける
   tab.AddToElementsArray(tindex,i_but);

//--- コントロールの作成
   if(!i_but.CreateButton(text,x_gap,y_gap))
      return(false);
//--- コントロールへのポインタをベースに追加する。
   CWndContainer::AddToElementsArray(0,i_but);
   return(true);
  }
 //----チェックボックス
bool CProgram::CreateCheckBox(CCheckBox &check,CWindow &win,const int windex,const int x_gap,const int y_gap,const int Xsize,const int Ysize,string text)
  {
//--- メイン・コントロールへのポインタを格納する。
   check.MainPointer(win);
//--- 作成前にプロパティを設定する
   check.XSize(Xsize);
   check.YSize(Ysize);
   check.IsPressed(false);


//--- コントロールの作成
   if(!check.CreateCheckBox(text,x_gap,y_gap))
      return(false);
//--- オブジェクト・グループの共通配列にオブジェクトを追加する。
    CWndContainer::AddToElementsArray(windex,check);
   return(true);
  }      

Program.mqhに戻る。

bool CProgram::CreateGUI()
  {

if(!CreateWindow("EA Panel"))
      return(false);
if(!CreateSubWindow(s_window,280,200,"SubWindow"))
  return(false);
if(!CreatetabIconButton(m_ibut1,m_tabs1,2,80,125,80,15,"Button 1",false,clrSilver))
        return(false);   
   if(!CreateIconButton(m_ibut2,s_window,3,70,150,60,20,"Button 2",false,clrSilver))
            return(false);       
   if(!CreateTextBox(t_box1,s_window,3,100,70,30,20," ",0,10,false))
      return(false);
   if(!CreateCheckBox(m_checkb1,s_window,3,20,70,70,20,"CheckBox1"))
      return(false); 
…...
….

CwndEvents::CompletedGUI();
return(true);
} 

メインパネルでタブを使ったので、ボタン用に別の関数を書いた。 そしてOnEvent関数で

void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
   if(id==CHARTEVENT_CUSTOM+ON_CLICK_BUTTON)
       {
       if(lparam==m_ibut1.Id())
         {
         s_window.OpenWindow();
         }
       }
   ....
....
  }

EasyAndFastGUIライブラリを使用した私のEAは以下のようになります:

 

こんにちは。mt4でライブラリのビルド15をコンパイルし、テーブル付きのパネルを作成した のですが、テーブルが定期的にちらつきます。メソッドにパラメータを渡さなければ、ちらつきは消えますが、テーブルのデータは変化しません。

   if(m_counter2.CheckTimeCounter())
     {
      SetValuesToTradeTable();
      UpdateTradeTable(true);

      //--- オープンポジションのシンボルを取得する
      string symbols_name[];
      int symbols_total=GetPositionsSymbols(symbols_name);
      //--- テーブルの値を更新する
      SetValuesToPositionsTable(symbols_name);
      //--- 更新前にユーザーによってすでに実行されているかどうかをソートする。
      //m_table_positions.SortData((uint)m_table_positions.IsSortedColumnIndex(),m_table_positions.IsSortDirection());
      //--- テーブルの更新
      UpdatePositionsTable(true);
     }
ファイル:
 
zlory73:

オブジェクト(ダイアログウィンドウも含む)を作成する関数を書いてください。例えば

まず、Program.mqhでダイアログウィンドウとその他のコントロール(ボタン、テキストボックス、チェックボックスなど)を宣言します:

MainWindow.mqhの中で:

wow...回答ありがとうございます...ただ、どの記事からライブラリをダウンロードしたのか確認したいのですが...私の進捗は1歩進んでいるのですが、ダイアログボックスとリンクしているすべてのオブジェクトがドラッグできず、うまく消えません.......記事のリンクも送っていただけるか、下のリンクが正しいかどうかだけ確認してください :) ...ライブラリはどこからダウンロードしたのですか?

https://www.mql5.com/ja/code/19703


私はそれを動作させるために努力を続けるでしょう :) 私は私のコードでいくつかの小さなミスを見なければなりません :) ...再びありがとうございました

EasyAndFastGUI library for creating graphical interfaces
EasyAndFastGUI library for creating graphical interfaces
  • www.mql5.com
The EasyAndFastGUI library allows creating graphical interfaces for custom MQL programs.
 

テーブルのちらつきを解決したというか、パラメータをtrueにしてセルにデータを書き込むと問題が消えた。

m_table_positions.SetValue(0,r,symbols_name[r],0,true);

を指定せずにテーブルを更新するメソッドを呼び出すと、問題は解消しました。

m_table_positions.Update();
 
Marcin Rutkowski:

wow ...thank you for answer ...just confirm to you download the library from which article ...my progress is 1 step forward, but all object linked with dialog box are not draggable and not disappearing properly ... ...私の進歩は1歩進んでいますが、ダイアログボックスとリンクしているオブジェクトはすべてドラッグできず、うまく消えません。...記事のリンクも送っていただけるか、下のリンクが正しいかどうかだけ確認させてください :) ...ライブラリはどこからダウンロードされたのですか?

https://www.mql5.com/ja/code/19703


私はそれを動作させるために努力し続けます :) 私は私のコードでいくつかの小さな間違いを見ないようにしなければなりません :) ...再びありがとうございます

こんにちは、Marcin。https://www.mql5.com/ja/articles/3527 から EasyAndFastGUI Build 16 をダウンロードし、アップデートを置き換えました:のTable.mqhとKeys.mqhを置き換えました。

in MQL5Include ■EasyAndFastGUI ■ from the article: https://www.mql5.com/en/articles/4715。

Graphical Interfaces XI: Integrating the Standard Graphics Library (build 16)
Graphical Interfaces XI: Integrating the Standard Graphics Library (build 16)
  • www.mql5.com
The first article Graphical Interfaces I: Preparation of the Library Structure (Chapter 1) explains in detail what this library is for. You will find a list of articles with links at the end of each chapter. There, you can also download a complete version of the library at the current stage of development. Files must be placed under the same...
 

ライブラリを再コンパイルしたが、クラスが見つからないと表示された。

class 'CWindow' is undefined Element.mqh