Throwing errors using NET listeners implemented in a class
1 次查看(过去 30 天)
显示 更早的评论
I'm implementing a .NET listener to run Matlab callbacks on a .NET application whenever certain buttons are clicked. This is done in a class, based on the instructions here:
These callbacks are supposed to throw errors as popups if the input is incorrect, and they use the error() function to do this. However, when I run the callbacks using the listeners, anything thrown using the error() function gets downgraded to a warning, and it prints in the Command Window instead of showing as a popup. It looks like this:
Warning: Error occurred while executing the listener callback for event Click defined for class System.Windows.Forms.Button:
Error using GetCanConfigForm/btnCreateSimFunc_Listener (line 75)
Please enter the CAN Rx Msg function name to create.
I can catch these "warnings" using try-catch & rethrow the errors using errordlg(). This does make a popup, but the OK buttons on the errordlg popups do nothing instead of closing the popup as expected. The X in the top right corner does work to close the popup.
How do I either force error() to throw popups in this context, or fix the errordlg() OK button to close the popup?
(Using Matlab R2019a)
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!