Hello @Alain Verleyen
Can you help me with this issue?
Is this my mistake or library problem?
Thank you
4. Finally, `CDialog::Create` triggers the `CWndContainer::Create` function, where the unexpected change occurs, replacing the original string value of `m_name` with an integer.
The app dialog is assigned a new 5-digits random number on each initialization of the program (e.g., timeframe change or terminal restart).
This random number is used as a prefix for all objects' names created on that dialog (as in your screenshot above).
More importantly, that 5-digits random number (dialog identifier) is always saved as fixed-width field inside the .dat file that is created inside \MQL5\Files\ folder upon destroying the dialog.
The standard library automatically saves the dialog's previous state (coordinates and minimized state) upon Destroy().
\MQL5\Include\Controls\Dialog.mqh
void CAppDialog::Destroy(const int reason) { IniFileSave(); }
However, to be able to restore the dialog position/minimized state (e.g, upon timeframe change or terminal restart),
you should call CAppDialog::IniFileLoad() inside your expert's OnInit() function:
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { TradingPanel = new CTradingPanel; string panelName = "TradingPanel"; if(!TradingPanel.Create(ChartID(), panelName, 0, 0, 17, 200, 420)) return(INIT_FAILED); Print("TradingPanel.Name()=", TradingPanel.Name()); //--- read the previous state of the program "dialog position and minimized state" TradingPanel.IniFileLoad(); //--- run application TradingPanel.Run(); return(INIT_SUCCEEDED); }
The app dialog is assigned a new 5-digits random number on each initialization of the program (e.g., timeframe change or terminal restart).
This random number is used as a prefix for all objects' names created on that dialog (as in your screenshot above).
More importantly, that 5-digits random number (dialog identifier) is always saved as fixed-width field inside the .dat file that is created inside \MQL5\Files\ folder upon destroying the dialog.
The standard library automatically saves the dialog's previous state (coordinates and minimized state) upon Destroy().
\MQL5\Include\Controls\Dialog.mqh
However, to be able to restore the dialog position/minimized state (e.g, upon timeframe change or terminal restart),
you should call CAppDialog::IniFileLoad() inside your expert's OnInit() function:

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello there
I'm encountering an issue with the AppDialog standard library in MQL5 and would appreciate some assistance in resolving it. The problem I'm facing is related to the unexpected change in the panel name during program initialization, specifically within the CWndContainer module.
Here's a brief overview of the problem:
I provide a string value as the program name in the CAppDialog::Create function. This name is intended to be assigned to the m_name parameter of the CDialog class.
However, when the program progresses and the CWndContainer::Create function is called, I noticed that the m_name parameter changes from the original string value to an integer. This alteration can be seen in the attached screenshots.
To outline the flow of the program:
1. The initial value of `m_name` is set within the `CAppDialog::Create` and the within CAppDialog::CreateCommon function.
2. The `CAppDialog::Create` function then calls `CAppDialog::CreateExpert`.
3. Within `CAppDialog::CreateExpert`, the `CDialog::Create` function is invoked.
4. Finally, `CDialog::Create` triggers the `CWndContainer::Create` function, where the unexpected change occurs, replacing the original string value of `m_name` with an integer.
My code:
I kindly request your assistance in identifying the cause of this issue and finding a suitable solution.
Thank you very much