What Is a MessageBox?¶
MessageBox is a new class added in cTrader 4.3. It allows for showing a dialog pop-up message box similar to the WFP message box.
Why Should I Use It?¶
Here are a couple of reasons for using the
MessageBox class instead of WinForms or WPF.
- The box uses the cTrader design and theme color.
- The box does not require the extension to have full access rights.
- It is easy-to-use compared to WinForms or WPF.
Using the Message Box in cTrader¶
To use the
MessageBox class, call its
Show() method and pass the parameters for the text, title, buttons, icons, and default value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
When running an instance of this cBot, you should see the following message box on instance start.
Show() method has multiple overloads. All of them are covered in our references library
The 'Logs' tab will display a corresponding event once you click on a button in a message box.
Notably, you can use the
MessageBox class anywhere in your cBots/indicators. The
Show() method will not return anything until you click on any of the buttons within a message box. While a message box is displayed, all other cBot/indicator events will be invoked normally.