https://github.com/tsnsoft/codelite_wxwidgets_div2_demo
Пример работы с wxWidgets с обработкой ошибок на C++ в CodeLite (linux, debian)
https://github.com/tsnsoft/codelite_wxwidgets_div2_demo
codelite cpp example linux wxwidgets
Last synced: about 1 year ago
JSON representation
Пример работы с wxWidgets с обработкой ошибок на C++ в CodeLite (linux, debian)
- Host: GitHub
- URL: https://github.com/tsnsoft/codelite_wxwidgets_div2_demo
- Owner: tsnsoft
- License: gpl-3.0
- Created: 2020-10-29T09:38:23.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-09T16:58:11.000Z (over 5 years ago)
- Last Synced: 2025-03-29T18:41:37.976Z (about 1 year ago)
- Topics: codelite, cpp, example, linux, wxwidgets
- Language: Makefile
- Homepage:
- Size: 2.05 MB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeLite_wxWidgets_Div2_demo
Пример работы с wxWidgets с обработкой ошибок на C++ в CodeLite (linux, debian)





## main.h:
```
class MainFrame : public MainFrameBase
{
public:
MainFrame(wxWindow* parent);
virtual ~MainFrame();
protected:
// protected event handlers
virtual void OnCloseFrame(
wxCloseEvent& event); // Копируем сюда из gui.h те методы, которые хотим реально реализовать
virtual void myClick(wxCommandEvent& event); // иначе все обявленные методы в gui.h останутся "пустыми"
};
```
## main.cpp или в любом своем файле *.cpp:
```
// ЭТО РЕАЛИЗАЦИЯ НАШЕГО МЕТОДА!
void MainFrame::myClick(wxCommandEvent& event)
{
try {
double a, b, c;
if(!m_textCtrl1->GetValue().ToDouble(&a))
throw std::logic_error("error: a");
if(!m_textCtrl2->GetValue().ToDouble(&b))
throw std::logic_error("error: b");
c = a / b;
if(isnan(c) || isinf(c)) {
throw std::logic_error("error: 0/0 or x/0");
}
m_staticText2->SetLabel(wxString::Format("%.5f", c));
} catch(std::exception& e) {
m_staticText2->SetLabel("???");
wxMessageBox(e.what());
}
}
```