Calling event handler directly

后端 未结 2 1649
渐次进展
渐次进展 2021-01-25 09:04

Having trouble to call an event handler directly from my code. I found the same question 2 years ago here. original question

But the line me_InsertCommentText(wxCo

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-25 09:51

    wxCommandEvent() is a temporary object, which couldn't be bound to non-const reference. You could use named variable here:

    wxCommandEvent event;
    me_InsertCommentText(event);
    

    or change the type of parameter to const reference:

    void mjpgen_wdDialog::me_InsertCommentText(const wxCommandEvent&)
    

    then

    me_InsertCommentText(wxCommandEvent());
    

提交回复
热议问题