disabled button sends EVT_BUTTON events
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
wxwidgets2.8 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Hello,
I recently run in a really weird behavior of wxwidgets.
I got an wxDialog (but it also works with wxFrame, see example below) in which I had a button and a wxTextCtrl.
The button is disabled on frame creation, but set as default.
If I click the return key, nothing happens as expected.
But if I select the textCtrl and then press return, the button event will be fired.
If I compile the exact same code on windows, no events are generated as expected.
My Version of wxWidgets is 2.8.12.1-6ubuntu2 on ubuntu 11.04 amd64.
Test code, compiled with "g++ Test.cpp `wx-config --libs --cxxflags` -o test":
#include <wx/wx.h>
class TestWindow: public wxFrame
{
public:
TestWindow();
private:
void OnOkClick(
DECLARE_
};
BEGIN_EVENT_
EVT_BUTTON(
END_EVENT_TABLE()
TestWindow:
wxFrame(NULL, wxID_ANY, _T("Test"))
{
wxSizer* sizer = new wxBoxSizer(
wxTextCtrl* textctrl = new wxTextCtrl(this, wxID_ANY);
wxButton* button = new wxButton(this, wxID_OK, _("&Press me"));
button-
button-
sizer-
sizer-
this->
this->Layout();
}
void TestWindow:
{
std::cout << "This shouldn't happen" << std::endl;
}
class Test: public wxApp
{
private:
bool OnInit();
};
DECLARE_APP(Test)
IMPLEMENT_APP(Test)
bool Test::OnInit()
{
TestWindow* win = new TestWindow();
return win->Show();
}
summary: |
- disabled button can be pressed + disabled button sends EVT_BUTTON events |