Files
MQL4Data/Libraries/x-saherelm.dialog.mq4
2024-01-25 04:05:58 +03:30

110 lines
2.0 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL4 Dialog Library
// ---------------------------------------------
// saherelm useful tools and definitions
// for handling dialogs ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// Includes Logger library ...
// #include "../Libraries/x-saherelm.lib.mq4"
#include "../Libraries/x-saherelm.log.lib.mq4"
//
#include <Controls\Dialog.mqh>
//
CAppDialog AppWindow;
//
// Prefix for Created Dialogs ...
string windowPrefix = "XWinD";
//
// Generate a random number for dialogs ...
int GenerateWindowNumber() {
//
int result = MathRand() + 1;
//
return result;
}
//
// Generate a Window Prefix ID ...
string GenerateWindowID() {
//
string result = windowPrefix;
//
// Generate INT ID ...
int idNum = GenerateWindowNumber();
//
result += "_" + StringConcatenate(idNum);
//
return result;
}
//
bool CreateDialog(
const string title = ""
) {
//
// string windowID = GenerateWindowID();
//
// Try to Create Window ...
bool result = AppWindow.Create(
0,
title,
0,
20,
20,
360,
324
);
//
if (result) {
AppWindow.Run();
}
//
return result;
}
//
void DestroyDialog(const int reason) {
AppWindow.Destroy(reason);
}
//
// Apply Chart Event on Created Window ...
void DialogChartEvent(
const int id, // event ID
const long& lparam, // event parameter of the long type
const double& dparam, // event parameter of the double type
const string& sparam // event parameter of the string type
) {
//
AppWindow.ChartEvent(
id,
lparam,
dparam,
sparam
);
}