Author Topic: wxWidgets and Brx/Arx  (Read 1324 times)

0 Members and 1 Guest are viewing this topic.

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
wxWidgets and Brx/Arx
« on: February 02, 2016, 10:03:35 pm »
Yet another attempt at  http://www.theswamp.org/index.php?topic=31587.0

Step 1, Download wxWidgets from https://www.wxwidgets.org/downloads/   I’m using 3.0.2 , which is also current as of this post

Step2, compile using the solution that matches your target 'visual studio version' in  wxWidgets-x.xx.x\build\msw. Build the libraries, not the DLLs, as we’re going to static link.

Step 3, in the output directory, i.e. wxWidgets-3.0.2\lib,  I inserted the compiler version in the library folder name, I.e. from  vc_x64_lib to vc110_x64_lib.

..next setting up the Arx/Brx project

 
« Last Edit: February 10, 2016, 12:59:13 am by nullptr »

kdub

  • SuperMod
  • Swamp Rat
  • Posts: 785
  • class keyThumper<T>:ILazy<T>
Re: wxWidgets and Brx/Arx
« Reply #1 on: February 02, 2016, 10:17:03 pm »

I notice they have DotNet binaries also
http://wxnet.sourceforge.net/binary.html
called Kerry in my other life

Sometimes the question is more important than the answer.

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #2 on: February 02, 2016, 10:24:43 pm »
Step 4, Add a Windows System Variable, that points to your wxWidgets folder, I used WxArx

Step 5, Create an Arx project and add the paths to your SDK, I don’t add MFC support.

Example include paths:
$(_SDK_PATH_)\inc;$( _SDK_PATH_)\inc-$(PlatformName);$(WxArx)\Include;$(WxArx)\include\msvc

Example  library paths are:
$(_SDK_PATH_)\lib-$(PlatformName);$(WxArx)\lib\vc120_x64_lib

Define:  __WXMSW__  and  wxMSVC_VERSION_AUTO

Add dependencies to the widgets libraries you'll be using, I added this to my  StdAfx.h

Code - C++: [Select]
  1.  
  2. #define __WXMSW__
  3. #define wxMSVC_VERSION_AUTO
  4.  
  5. #ifdef __WXMSW__
  6. #include <wx/wx.h>
  7. #include <wx/string.h>
  8. #include <wx/xrc/xmlres.h>
  9.  
  10. #pragma comment(lib, "wxbase30u.lib")
  11. #pragma comment(lib, "wxtiff.lib")
  12. #pragma comment(lib, "wxbase30u_net.lib")
  13. #pragma comment(lib, "wxscintilla.lib")
  14. #pragma comment(lib, "wxbase30u_xml.lib")
  15. #pragma comment(lib, "wxregexu.lib")
  16. #pragma comment(lib, "wxexpat.lib")
  17. #pragma comment(lib, "wxpng.lib")
  18. #pragma comment(lib, "wxjpeg.lib")
  19. #pragma comment(lib, "wxmsw30u_xrc.lib")
  20. #pragma comment(lib, "wxmsw30u_adv.lib")
  21. #pragma comment(lib, "wxmsw30u_webview.lib")
  22. #pragma comment(lib, "wxmsw30u_aui.lib")
  23. #pragma comment(lib, "wxmsw30u_stc.lib")
  24. #pragma comment(lib, "wxmsw30u_core.lib")
  25. #pragma comment(lib, "wxmsw30u_richtext.lib")
  26. #pragma comment(lib, "wxmsw30u_gl.lib")
  27. #pragma comment(lib, "wxmsw30u_ribbon.lib")
  28. #pragma comment(lib, "wxmsw30u_html.lib")
  29. #pragma comment(lib, "wxmsw30u_qa.lib")
  30. #pragma comment(lib, "wxmsw30u_media.lib")
  31. #pragma comment(lib, "wxzlib.lib")
  32. #pragma comment(lib, "wxmsw30u_propgrid.lib")
  33. #endif
  34.  
  35.  

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #3 on: February 02, 2016, 10:32:32 pm »

I notice they have DotNet binaries also
http://wxnet.sourceforge.net/binary.html

I haven't tried those yet, could be interesting!

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #4 on: February 02, 2016, 10:39:09 pm »
Next we need an application class that derives from wxApp, it’s important that we
define IMPLEMENT_APP_NO_MAIN or wxIMPLEMENT_APP_NO_MAIN , 
as this is a plug-in and we want to use the host applications messages

Code - C++: [Select]
  1. //WxRxApp.h
  2. class WxRxApp : public wxApp
  3. {
  4. public:
  5.    virtual bool OnInit();
  6.    static bool initWxApp();
  7.    static void uninitWxApp();
  8.    static wxWindow* mainWindow();
  9. };
  10.  


Code - C++: [Select]
  1. //WxRxApp.cpp
  2. #include "stdafx.h"
  3. #include "WxRxApp.h"
  4. #include "wx/aui/aui.h"
  5.  
  6. class WinFrame : public wxFrame
  7. {
  8. public:
  9.    WinFrame(HWND hwnd)
  10.    {
  11.        this->SetHWND(hwnd);
  12.        this->AdoptAttributesFromHWND();
  13.        this->m_isShown = true;
  14.        wxTopLevelWindows.Append(this);
  15.    }
  16. };
  17.  
  18. static WinFrame* getMainWindow()
  19. {
  20.    static WinFrame* win = NULL;
  21.    if (win == NULL)
  22.        win = new WinFrame(adsw_acadMainWnd());
  23.    return win;
  24. }
  25.  
  26. WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
  27.  
  28. bool WxRxApp::OnInit()
  29. {
  30.    wxSetInstance(acrxGetApp()->GetModuleInstance());
  31.    wxTheApp->SetTopWindow(getMainWindow());
  32.    ::wxInitAllImageHandlers();
  33.    wxXmlResource::Get()->InitAllHandlers();
  34.    return (wxTheApp->GetTopWindow() != NULL);
  35. }
  36.  
  37. bool WxRxApp::initWxApp()
  38. {
  39.    if (wxInitialize())
  40.    {
  41.        wxApp::SetInstance(new WxRxApp());
  42.        if (wxTheApp && wxTheApp->CallOnInit())
  43.            return true;
  44.    }
  45.    return false;
  46. }
  47.  
  48. void WxRxApp::uninitWxApp()
  49. {
  50.    wxUninitialize();
  51. }
  52.  
  53. wxWindow* WxRxApp::mainWindow()
  54. {
  55.    return getMainWindow();
  56. }
  57.  
  58. IMPLEMENT_APP_NO_MAIN(WxRxApp); //need this
  59. IMPLEMENT_WX_THEME_SUPPORT;
  60.  

edit added WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
« Last Edit: February 10, 2016, 12:53:00 am by nullptr »

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #5 on: February 02, 2016, 10:46:54 pm »
Now we can initialize our wxApp in On_kInitAppMsg and uninitialize in On_kUnloadAppMsg

Code - C++: [Select]
  1. virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
  2. // TODO: Load dependencies here
  3.  
  4. // You *must* call On_kInitAppMsg here
  5. AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
  6.  
  7.  
  8.        if (!WxRxApp::initWxApp()) //
  9.            acutPrintf(_T("\nError initializing wxWidgets\n"));
  10.  
  11. return (retCode) ;
  12. }
  13.  
  14. virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
  15. // TODO: Add your code here
  16.  
  17.        WxRxApp::uninitWxApp();
  18.  
  19. // You *must* call On_kUnloadAppMsg here
  20. AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
  21.  
  22. // TODO: Unload dependencies here
  23.  
  24. return (retCode) ;
  25. }
  26.  

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #6 on: February 02, 2016, 11:01:01 pm »
Added sample VS2015 project to the first post.

MickD

  • Gator
  • Posts: 2882
  • I don't need a job, I need Money!!
Re: wxWidgets and Brx/Arx
« Reply #7 on: February 03, 2016, 12:37:04 am »
Thanks Daniel! will take a look soon as BRX has been on my TODO list for a while now.
"A language that doesn’t have everything is actually easier to program in than some that do."

        — Dennis M. Ritchie

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #8 on: February 03, 2016, 02:06:25 am »
Thanks Daniel! will take a look soon as BRX has been on my TODO list for a while now.

Its cool  :wink:

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #9 on: February 03, 2016, 02:08:48 am »
Sample dialog

Code - C++: [Select]
  1. #pragma once
  2.  
  3. class MyDialog : public wxDialog
  4. {
  5. public:
  6.    MyDialog(wxWindow *parent);
  7.    void OnButton(wxCommandEvent& event);
  8.    virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
  9. private:
  10.    wxButton *m_btnModal,
  11.             *m_btnModeless,
  12.             *m_btnDelete;
  13.  
  14.    wxDECLARE_EVENT_TABLE();
  15. };
  16.  

Code - C++: [Select]
  1. #include "stdafx.h"
  2. #include "SampWxDialog1.h"
  3.  
  4. wxBEGIN_EVENT_TABLE(MyDialog, wxDialog)
  5.  EVT_BUTTON(wxID_ANY, MyDialog::OnButton)
  6. wxEND_EVENT_TABLE()
  7.  
  8. MyDialog::MyDialog(wxWindow *parent)
  9.    : wxDialog(parent, wxID_ANY, wxString(wxT("Modal dialog")))
  10. {
  11.    wxBoxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
  12.    sizerTop->Add(new wxButton(this, wxID_CLOSE), 0, wxALIGN_CENTER | wxALL, 5);
  13.    SetSizerAndFit(sizerTop);
  14.    SetEscapeId(wxID_CLOSE);
  15.    CenterOnParent();
  16. }
  17.  
  18. void MyDialog::OnButton(wxCommandEvent& event)
  19. {
  20.    if (this->IsModal())
  21.        EndModal(wxID_CANCEL);
  22.    else
  23.        this->Destroy();
  24. }
  25.  
  26. WXLRESULT MyDialog::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
  27. {
  28.    switch (nMsg)
  29.    {
  30.    case WM_ACAD_KEEPFOCUS:
  31.        return TRUE;
  32.    }
  33.    return wxDialog::MSWWindowProc(nMsg, wParam, lParam);
  34. }
  35.  

Code - C++: [Select]
  1.    static void WxRxProject_wxTest4(void)
  2.    {
  3.        wxWindow *win = WxRxApp::mainWindow();
  4.        if (win)
  5.        {
  6.            MyDialog  custDiag(win);
  7.            custDiag.ShowModal();
  8.        }
  9.    }
  10.  
  11.    static void WxRxProject_wxTest5(void)
  12.    {
  13.        wxWindow *win = WxRxApp::mainWindow();
  14.        if (win)
  15.        {
  16.            MyDialog *custDiag = new MyDialog(win);
  17.            custDiag->Show();
  18.        }
  19.    }
  20.  

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #10 on: February 03, 2016, 02:11:24 am »

For modeless dialogs, you will need to override MSWWindowProc and handle WM_ACAD_KEEPFOCUS message

Code - C++: [Select]
  1. virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
  2.  

Code - C++: [Select]
  1. WXLRESULT WxArxTestDlg::MSWWindowProc( WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam )
  2. {
  3.  switch(nMsg)
  4.  {
  5.  case WM_ACAD_KEEPFOCUS:
  6.    return TRUE;
  7.  }
  8.  return wxDialog::MSWWindowProc(nMsg, wParam, lParam);
  9. }
  10.  

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #11 on: February 03, 2016, 02:22:19 am »
WxUserInteraction class is a helper class to hide modal dialogs so you can interact with the editor

Code - C++: [Select]
  1. class WxUserInteraction
  2. {
  3.    HWND m_activeWindow;
  4.    std::vector<HWND> m_wnds;
  5. public:
  6.    WxUserInteraction();
  7.    WxUserInteraction(AcApDocument* pDocument,bool prompting);
  8.    virtual ~WxUserInteraction(void);
  9.  protected:
  10.    void userInteraction(AcApDocument* pDocument,bool prompting);
  11.    void undoUserInteraction();
  12. };
  13.  

Code - C++: [Select]
  1. WxUserInteraction::WxUserInteraction()
  2. {
  3.    userInteraction(acDocManagerPtr()->curDocument(),true);
  4. }
  5.  
  6. WxUserInteraction::WxUserInteraction( AcApDocument* pDocument,bool prompting )
  7. {
  8.    userInteraction(pDocument,prompting);
  9. }
  10.  
  11. WxUserInteraction::~WxUserInteraction(void)
  12. {
  13.  undoUserInteraction();
  14. }
  15.  
  16. void WxUserInteraction::userInteraction(AcApDocument* pDocument,bool prompting)
  17. {    
  18.    AcApDocManager* pDocMan = acDocManagerPtr();
  19.    if(pDocMan->curDocument() == pDocument)
  20.    {
  21.        pDocMan->disableDocumentActivation();
  22.        if(!prompting)
  23.            return;
  24.  
  25.        HWND hwMainWnd = adsw_acadMainWnd();
  26.        if(::IsWindowEnabled(hwMainWnd) == TRUE)
  27.            return;
  28.  
  29.        m_activeWindow = GetFocus();
  30.        for (HWND window = ::GetActiveWindow(); window != NULL; window = ::GetWindow(window, GW_OWNER))
  31.        {
  32.            if (window == hwMainWnd)
  33.                break;
  34.            m_wnds.push_back(window);
  35.        }
  36.        ::EnableWindow(hwMainWnd, TRUE);
  37.        ::SetFocus(hwMainWnd);
  38.        for(size_t idx = 0 ; idx < m_wnds.size() ; idx++)
  39.        {
  40.            ::ShowWindow(m_wnds[idx],SW_HIDE);
  41.        }
  42.    }
  43. }
  44.  
  45. void WxUserInteraction::undoUserInteraction()
  46. {
  47.  acDocManagerPtr()->enableDocumentActivation();
  48.  if(m_wnds.size() > 0)
  49.  {
  50.    for (std::vector<HWND>::reverse_iterator it = m_wnds.rbegin() ; it != m_wnds.rend(); ++it)
  51.    {
  52.     ::ShowWindow(*it,SW_SHOW);
  53.    }
  54.    ::EnableWindow(adsw_acadMainWnd(), FALSE);
  55.    ::SetFocus(m_activeWindow);
  56.  }
  57. }
  58.  

example

Code - C++: [Select]
  1. void WxArxTestDlg::OnButtonClick( wxCommandEvent& event )
  2. {
  3.  WxUserInteraction action;
  4.  AcGePoint3d pnt;
  5.  ads_name name = {0L, 0L};
  6.  if (acedEntSel(_T("\nSelect Entity"), name, asDblArray(pnt)) == RTNORM)
  7.  {
  8. ....
  9.  }
  10.  event.Skip();
  11. }
  12.  

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #12 on: February 03, 2016, 02:27:37 am »
Next I'll create a sample using DialogBlocks, http://www.dialogblocks.com/  8-)

nullptr

  • BricsCAD
  • Needs a day job
  • Posts: 6698
  • AKA Daniel
Re: wxWidgets and Brx/Arx
« Reply #13 on: February 03, 2016, 05:35:31 am »
using XML Based Resource System (XRC), see http://docs.wxwidgets.org/3.0/overview_xrc.html

Code - XML: [Select]
  1. <?xml version="1.0" ?>
  2. <resource version="2.3.0.1">
  3. <object class="wxDialog" name="SimpleDialog">
  4. <title>Simple dialog</title>
  5. <object class="wxBoxSizer">
  6. <orient>wxVERTICAL</orient>
  7. <object class="sizeritem">
  8. <object class="wxTextCtrl" name="text"/>
  9. <option>1</option>
  10. <flag>wxALL|wxEXPAND</flag>
  11. <border>10</border>
  12. </object>
  13. <object class="sizeritem">
  14. <object class="wxBoxSizer">
  15. <object class="sizeritem">
  16. <object class="wxButton" name="clickme_btn">
  17. <label>Click</label>
  18. </object>
  19. <flag>wxRIGHT</flag>
  20. <border>10</border>
  21. </object>
  22. <object class="sizeritem">
  23. <object class="wxButton" name="wxID_OK">
  24. <label>OK</label>
  25. </object>
  26. <flag>wxLEFT</flag>
  27. <border>10</border>
  28. </object>
  29. <orient>wxHORIZONTAL</orient>
  30. </object>
  31. <flag>wxALL|wxALIGN_CENTRE</flag>
  32. <border>10</border>
  33. </object>
  34. </object>
  35. </object>
  36. </resource>
  37.  


in On_kInitAppMsg
Code - C++: [Select]
  1. wxXmlResource::Get()->Load("C:\\Temp\\resource.xrc");
  2.  

Code - C++: [Select]
  1.   static void WxRxProject_wxTest6(void)
  2.    {
  3.        wxWindow *win = WxRxApp::mainWindow();
  4.        if (win)
  5.        {
  6.            wxDialog dlg;  
  7.            if(wxXmlResource::Get()->LoadDialog(&dlg, win, "SimpleDialog"))
  8.                dlg.ShowModal();
  9.        }
  10.    }
  11.  


olegog

  • Mosquito
  • Posts: 1
Re: wxWidgets and Brx/Arx
« Reply #14 on: February 14, 2016, 07:23:49 pm »
Hi Daniel.
Your example works fine.
But.  I need put my window to CAdUiPaletteSet.  And it does not work.

I use consistency for initialisation
Code - C++: [Select]
  1. extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  2. {
  3. UNREFERENCED_PARAMETER(lpReserved) ;
  4. if (DLL_PROCESS_ATTACH == dwReason)
  5.    {
  6. //WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
  7. //wxSetInstance(hInstance);
  8.  
  9. SampleDLL.AttachInstance(hInstance);
  10. InitAcUiDLL();
  11.  
  12. hinst_l = hInstance;   // use this HINSTANCE
  13. }
  14.    else if (DLL_PROCESS_DETACH == dwReason)
  15.    {
  16. SampleDLL.DetachInstance();
  17. }
  18. return TRUE;
  19. }
  20.  

then

Code - C++: [Select]
  1.    virtual AcRx::AppRetCode On_kInitAppMsg(void* pAppData)
  2.    {
  3.        AcRx::AppRetCode result = AcRxArxApp::On_kInitAppMsg(pAppData);
  4. startGUI();  // this my function
  5.        return result;
  6.    }
  7.  
Code - C++: [Select]
  1. void startGUI()
  2. {
  3. wxApp::m_nCmdShow = 0;
  4. int argc = 0;
  5. char **argv = NULL;
  6. if (wxEntryStart(argc, argv))
  7. {
  8. WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
  9. wxSetInstance(hinst_l);
  10.  
  11. m_pPaletteSet = new CAdUiPaletteSet();
  12. m_pPaletteSet->Create(_T("Test BAR"), WS_OVERLAPPED | WS_DLGFRAME, CRect(0, 0, 100, 100), pWnd);
  13. m_pPaletteSet->EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT | CBRS_FLOATING);
  14.  
  15. HWND hWnd4 = m_pPaletteSet->m_hWnd;
  16. win4 = new wxWindow();
  17. win4->SetHWND((WXHWND)hWnd4);
  18. win4->AdoptAttributesFromHWND();
  19. wxTopLevelWindows.Append(win4);
  20.  
  21.  
  22. m_panel = new myPanel(win4, wxID_ANY, wxPoint(0, 0), wxSize(400, 400), wxTAB_TRAVERSAL);
  23. butTmp = new mywxButton(m_panel, ID_TESTREPLACE, wxT("Test But"), wxDefaultPosition, wxSize(100, 100));
  24.  
  25. m_pPaletteSet->RestoreControlBar(AFX_IDW_DOCKBAR_LEFT);
  26. acedGetAcadFrame()->ShowControlBar(m_pPaletteSet, TRUE, FALSE);
  27. }
  28. }
  29.  
Now it works. That is,  i have palette, where puted panel and button. 
But when i clicked on panel or button i get exeption

Code: [Select]
---------------------------
wxWidgets Debug Alert
---------------------------
..\..\src\msw\button.cpp(272): assert "tlw" failed in GetTLWParentIfNotBeingDeleted(): logic error in GetTLWParentIfNotBeingDeleted()

Call stack:
[00] wxButton::MSWWindowProc                  d:\wxwidgets_3.0.2\src\msw\button.cpp:431
[01] wxWndProc                                d:\wxwidgets_3.0.2\src\msw\window.cpp:2716
[02] DispatchMessageW                       
[03] GetSysColorBrush                       
[04] GetSysColorBrush                       
[05] KiUserCallbackDispatcher               
[06] SetFocus                               
[07] ImageList_SetOverlayImage               
[08] ImageList_SetOverlayImage               
[09] DispatchMessageW                       
[10] CallWindowProcW                         
[11] wxWindow::MSWDefWindowProc              d:\wxwidgets_3.0.2\src\msw\window.cpp:2271
[12] wxWindow::MSWWindowProc                  d:\wxwidgets_3.0.2\src\msw\window.cpp:3651
[13] wxWndProc                                d:\wxwidgets_3.0.2\src\msw\window.cpp:2716
[14] DispatchMessageW                       
[15] NotifyWinEvent                         
[16] CharLowerW                             
[17] 000000005C2FA9E0
[18] 000000005C22BCCA
[19] 000000005C2DFCFE
[20] 000000005C2C51F7
Do you want to stop the program?
You can also choose [Cancel] to suppress further warnings.

Code - C++: [Select]
  1. //file button.cpp
  2.  
  3. // return the top level parent window if it's not being deleted yet, otherwise
  4. // return NULL
  5. static wxTopLevelWindow *GetTLWParentIfNotBeingDeleted(wxWindow *win)
  6. {
  7.    for ( ;; )
  8.    {
  9.        // IsTopLevel() will return false for a wxTLW being deleted, so we also
  10.        // need the parent test for this case
  11.        wxWindow * const parent = win->GetParent();
  12.        if ( !parent || win->IsTopLevel() )
  13.        {
  14.            if ( win->IsBeingDeleted() )
  15.                return NULL;
  16.  
  17.            break;
  18.        }
  19.  
  20.        win = parent;
  21.    }
  22.  
  23.    wxASSERT_MSG( win, wxT("button without top level parent?") );
  24.  
  25.    wxTopLevelWindow * const tlw = wxDynamicCast(win, wxTopLevelWindow);
  26.    wxASSERT_MSG( tlw, wxT("logic error in GetTLWParentIfNotBeingDeleted()") );  // 272
  27.  
  28.    return tlw;
  29. }
  30.  
String     wxASSERT_MSG( tlw, wxT("logic error in GetTLWParentIfNotBeingDeleted()") ) call
wxDefaultAssertHandler

Code - C++: [Select]
  1. //file appbase.cpp
  2. // default assert handler
  3. static void
  4. wxDefaultAssertHandler(const wxString& file,
  5.                       int line,
  6.                       const wxString& func,
  7.                       const wxString& cond,
  8.                       const wxString& msg)
  9. {
  10.    // If this option is set, we should abort immediately when assert happens.
  11.    if ( wxSystemOptions::GetOptionInt("exit-on-assert") )
  12.        wxAbort();
  13.  
  14.    // FIXME MT-unsafe
  15.    static int s_bInAssert = 0;
  16.  
  17.    wxRecursionGuard guard(s_bInAssert);
  18.    if ( guard.IsInside() )
  19.    {
  20.        // can't use assert here to avoid infinite loops, so just trap
  21.        wxTrap();
  22.  
  23.        return;
  24.    }
  25.  
  26.    if ( !wxTheApp )
  27.    {
  28.        // by default, show the assert dialog box -- we can't customize this
  29.        // behaviour
  30.        ShowAssertDialog(file, line, func, cond, msg);
  31.    }
  32.    else
  33.    {
  34.        // let the app process it as it wants
  35.        // FIXME-UTF8: use wc_str(), not c_str(), when ANSI build is removed
  36.        wxTheApp->OnAssertFailure(file.c_str(), line, func.c_str(),
  37.                                  cond.c_str(), msg.c_str());
  38.    }
  39. }
  40.  

I can't understand why i can't get event click on button.

Could  you help me?