Author Topic: wxSmith Couldn't Add New Handler  (Read 599 times)

Offline Lowkus

  • Multiple posting newcomer
  • *
  • Posts: 14
wxSmith Couldn't Add New Handler
« on: May 16, 2018, 11:08:42 pm »
When I try to look at the events list in wxSmith, on any of three forms, it is not showing the events that I had created through wxSmith in the past.  If I try to add an event now, wxSmith asks me for an event name and I enter a unique name, then it throws an error "Couldn't Add New Handler".  Querying the search engines for answers, someone said it can happen when the project file points to incorrect files, but I don't see anything wrong (see code).  What is the reason that wxSmith is failing to handle events correctly?  How can I get it working again?

Code: [Select]
<Extensions>
<code_completion />
<envvars />
<debugger />
<wxsmith version="1">
<gui name="wxWidgets" src="src\cshpApp.cpp" main="frmTr" init_handlers="necessary" language="CPP" />
<resources>
<wxFrame wxs="wxsmith/frmMa.wxs" src="src/frmMa.cpp" hdr="src/inc/frmMa.h" fwddecl="0" i18n="1" name="frmMa" language="CPP" />
<wxFrame wxs="wxsmith/frmPa.wxs" src="src/frmPa.cpp" hdr="src/inc/frmPa.h" fwddecl="0" i18n="1" name="frmPa" language="CPP" />
<wxFrame wxs="wxsmith/frmTr.wxs" src="src/frmTr.cpp" hdr="src/inc/frmTr.h" fwddecl="0" i18n="1" name="frmTr" language="CPP" />
</resources>
</wxsmith>
</Extensions>

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10896
    • Travis build status
Re: wxSmith Couldn't Add New Handler
« Reply #1 on: May 17, 2018, 12:24:31 am »
Can you reproduce this problem on a minimal sample project?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Lowkus

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxSmith Couldn't Add New Handler
« Reply #2 on: May 17, 2018, 04:10:10 am »
I don't get the error when I create a new simple project.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10896
    • Travis build status
Re: wxSmith Couldn't Add New Handler
« Reply #3 on: May 17, 2018, 09:14:20 am »
Can you inspect/compare the projects and see if you can find the thing that causes the problem?
Can you trim your project and post it?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline gd_on

  • Regular
  • ***
  • Posts: 412
Re: wxSmith Couldn't Add New Handler
« Reply #4 on: May 17, 2018, 01:50:14 pm »
I had such a problem on Windows 7, and for me, if I remember well, it was solved by changing the character encoding of sources files to UTF8 and/or making paths to my files containing only standard ascii characters. The problem was apparently caused by accentuated characters (as we have in french).
gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.1 (64 bits) compiled by TDM 4.9.2 in C:\MinGW64

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10896
    • Travis build status
Re: wxSmith Couldn't Add New Handler
« Reply #5 on: May 17, 2018, 06:37:28 pm »
gd_on: Can you try to reproduce this problem?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Lowkus

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxSmith Couldn't Add New Handler
« Reply #6 on: May 18, 2018, 06:19:09 am »
I copied the wxs code from the failing project to the good project, it still works in the good project, so the problem can't be in the wxs code.  I'll keep looking for the problem.

Update: Something is telling wxSmith where to find the event code, whatever chunk of code is providing that linkage is the cause of the problem as far as I can tell.  I don't have time to debug it anymore, I'm just going to copy my code to the new project and hook up the form event connections from scratch.
« Last Edit: May 18, 2018, 08:23:23 am by Lowkus »

Offline gd_on

  • Regular
  • ***
  • Posts: 412
Re: wxSmith Couldn't Add New Handler
« Reply #7 on: May 18, 2018, 09:35:22 am »
Sorry, I have not been able to reproduce the problem. :(
I am sure that accentuated character in path is sometimes a problem : for example, if codeblocks source path contains such character, as for example my firstname "Gérard", compilation fails on many "assert" instructions (but this has nothing to do with wxSmith !). No problem, if my path contains "Gerard", so replacing the "é" by a "e".
As said before, I had the same problem a few month ago ("Couldn't Add New Handler"), but apparently not caused by accentuated characters in the path ! Strange : I was almost sure the problem was here ! Sorry.  :-[
gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.1 (64 bits) compiled by TDM 4.9.2 in C:\MinGW64

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10896
    • Travis build status
Re: wxSmith Couldn't Add New Handler
« Reply #8 on: May 18, 2018, 01:03:11 pm »
I copied the wxs code from the failing project to the good project, it still works in the good project, so the problem can't be in the wxs code.  I'll keep looking for the problem.

Update: Something is telling wxSmith where to find the event code, whatever chunk of code is providing that linkage is the cause of the problem as far as I can tell.  I don't have time to debug it anymore, I'm just going to copy my code to the new project and hook up the form event connections from scratch.

Have you used a diff tool to compare the two project files? I think all information for wxSmith is stored in the cbp file.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Lowkus

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: wxSmith Couldn't Add New Handler
« Reply #9 on: May 19, 2018, 08:04:20 am »
I just eyeballed the two files, but there wasn't more than a few lines to compare.  I've gotten the new project working and the old one is in the trash now, if I run into the problem again I might return to the search for the cause.  Somebody who really understands how wxSmith works will probably know how to fix the problem.