Bug #19334 2014-03-18 11:52

kasty

Connecting events in wxSmith lacks full casting for MSVC

When I create an event with CB+wxSmith, the implementation in the CPP looks like this:

Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&MyPanel::OnEvent);

MSVC compilers don't accept it, and need this notation instead:

Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)&MyPanel::OnEvent);

Some events need a different casting, i.e., Close events would look like

Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)(wxEventFunction)(wxCloseEventFunction)&MyPanel::OnEvent);

and List events would look like this:

Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)(wxEventFunction)(wxListEventFunction)&MyPanel::OnEvent);

There's a switch in Visual C++ compiler that accepts the notation currently in use: /vmm. However I strongly advise not to use it because it is likely to bring hard to find bugs (stack corruption in my case).

I didn't see any option to control the casting style from the IDE, and other people are complaining about this issue since years ago all over internet. I searched for open and closed bugs with no lack. Maybe nobody ever submitted one? It's weird, CB+MSVC is being used by many people...

Category
Plugin::wxSmith
Group
Platform:Windows
Status
Open
Close date
 
Assigned to