Message box¶
Introduction¶
MessageBox
was added in cTrader 4.3. It allows for showing a dialogue pop-up message box similar to the WPF message box.
Key reasons for using message boxes¶
Here are a few reasons for using the MessageBox
class instead of WinForms or WPF:
- The box uses the cTrader design and theme colour.
- The box does not require the algo to have full access rights.
- It is easy to use compared to WinForms or WPF.
Use 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.
The 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 a button in a message box.
Notably, you can use the MessageBox
class anywhere in your cBots and indicators. The Show()
method will not return anything until you click any of the buttons within a message box. While a message box is displayed, all other cBot and indicator events will be invoked normally.