Iam a Greenhorn in C++ and wxWidgets. I started to learn C++ and wxWIdgets.
I trying now to Create a Link as Menu.
With this Link i want to Switch for Exampe TExt in a TExtfeld on or Off.
The Link should have an Orange hover effect (when mouse over the link).
And when the Mouse leaves the Link it should fade slowly out for example 2 seconds or less.
i have no idea how to code this. i treid many times but don't get it to work.
Can someone help me out? Just a Sample?
I got here an code working but only with button instead of links.
#include <wx/wx.h>
class MyFrame : public wxFrame {
public:
MyFrame(const wxString& title)
: wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300)) {
m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
auto vbox = new wxBoxSizer(wxVERTICAL);
vbox->Add(m_textCtrl, 1, wxEXPAND | wxALL, 10);
auto hbox = new wxBoxSizer(wxHORIZONTAL);
auto schalteANButton = new wxButton(this, wxID_ANY, "SchalteAN");
hbox->Add(schalteANButton, 0, wxALL, 10);
hbox->AddStretchSpacer(1);
auto schalteAusButton = new wxButton(this, wxID_ANY, "SchalteAus");
hbox->Add(schalteAusButton, 0, wxALL, 10);
vbox->Add(hbox, 0, wxEXPAND);
SetSizerAndFit(vbox);
schalteANButton->Bind(wxEVT_BUTTON, &MyFrame::OnSchalteANButtonClicked, this);
schalteAusButton->Bind(wxEVT_BUTTON, &MyFrame::OnSchalteAusButtonClicked, this);
}
private:
void OnSchalteANButtonClicked(wxCommandEvent& event) {
m_textCtrl->SetValue("OK");
}
void OnSchalteAusButtonClicked(wxCommandEvent& event) {
m_textCtrl->Clear();
}
wxTextCtrl* m_textCtrl;
};
class MyApp : public wxApp {
public:
bool OnInit() override {
auto frame = new MyFrame("Hello wxWidgets");
frame->Show();
return true;
}
};
wxIMPLEMENT_APP(MyApp);