wxEVT_TEXT_ENTER doesn't get fired on mac

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
bhaweshkc
Earned a small fee
Earned a small fee
Posts: 16
Joined: Tue Jan 12, 2016 6:22 am

wxEVT_TEXT_ENTER doesn't get fired on mac

Post by bhaweshkc » Wed Aug 01, 2018 8:52 am

Below is the sample application using which i am able to reproduce the problem

Code: Select all

#include <wx/wx.h>

class MyApp : public wxApp
{
public:
    MyApp();
    bool OnInit() override;
    int OnExit() override;

private:
    wxFrame * m_pFrame;
};

wxIMPLEMENT_APP(MyApp);

class Frame : public wxFrame
{
public:
    Frame();
    void OnTextChange(wxCommandEvent& evt);
    void OnEnterPress(wxCommandEvent& evt);

private:
    wxTextCtrl * m_textCtrl;
    wxTextCtrl * m_logtextCtrl;
};

MyApp::MyApp()
{

}

bool MyApp::OnInit()
{
    m_pFrame = new Frame();
    m_pFrame->SetSize(wxSize(640, 480));
    m_pFrame->SetMinSize(wxSize(640, 480));
    m_pFrame->CenterOnScreen();
    m_pFrame->Show();
    return true;
}

int MyApp::OnExit()
{
    return 0;
}

Frame::Frame() : wxFrame(NULL, wxID_ANY, "Test", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
{
    SetBackgroundColour(*wxWHITE);
    wxBoxSizer* verticalSizer = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer* hSizer = new wxBoxSizer(wxHORIZONTAL);
    wxStaticText* staticText = new wxStaticText(this, wxID_ANY, "TextCtrl:: ");
    hSizer->Add(staticText, 0, wxALIGN_CENTER_VERTICAL);
    m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
    m_textCtrl->Bind(wxEVT_TEXT_ENTER, &Frame::OnEnterPress, this);
    m_textCtrl->Bind(wxEVT_TEXT, &Frame::OnTextChange, this);
    hSizer->Add(m_textCtrl, 1, wxEXPAND);
    verticalSizer->Add(hSizer, 0, wxEXPAND);

    m_logtextCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
    verticalSizer->Add(m_logtextCtrl, 1, wxEXPAND);
    wxLog::SetActiveTarget(new wxLogTextCtrl(m_logtextCtrl));
    SetSizerAndFit(verticalSizer);
}

void Frame::OnTextChange(wxCommandEvent& evt)
{
    m_logtextCtrl->AppendText(wxString("Text Changed:") + m_textCtrl->GetValue() + wxString("\n"));
}

void Frame::OnEnterPress(wxCommandEvent& evt)
{
    m_logtextCtrl->AppendText("Enter Press on Text Ctrl\n");
}
issue is also reproducible on sample "widgets" demo application which comes with wx source.
looking for possible workaround for this problem.
this issue is not reproducible on previous version (wxWidgets 3.0)

Library Version and System i am using::
wxWidgets Version: 3.1
OS : MAC OS High Sierra 10.13.3

Update:
issue is reported and fixed here
https://trac.wxwidgets.org/ticket/18101
Last edited by bhaweshkc on Wed Sep 05, 2018 6:57 am, edited 1 time in total.

DavidHart
Site Admin
Site Admin
Posts: 3881
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxEVT_TEXT_ENTER doesn't get fired on mac

Post by DavidHart » Wed Aug 01, 2018 10:54 am

Hi,

This works as expected on Linux, so I've moved the topic to 'Platform Related Issues'.

In general, if you have a reproducible wx bug, especially one that can be demonstrated in one of the wx samples, you should search wx-trac for previous reports. If none, you should open one.

Edit: Oh, and if by wx3.1 you mean wx3.1.0, you should first check the bug still happens with git HEAD.

Regards,

David

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3403
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxEVT_TEXT_ENTER doesn't get fired on mac

Post by ONEEYEMAN » Wed Aug 01, 2018 4:49 pm

Hi,
Out of curiosity - did you build the library yourself? If yes - what configure line did you use?
Are you able to debug this using lldb? What happen when you try to enter the text?

Thank you.

Post Reply