User forums > Using Code::Blocks

wxSmith/wxGrid incompatibility with wx3.1 wxEVT_GRID_CELL_CHANGE(D)

<< < (2/3) > >>

Miguel Gimenez:
I have added a target version setting in Editor->wxSmith and version information to selected events so they are discarded if not available in that version. This includes the events from wxGrid, wxDirCtrl and wxComboBox.

CAVEATS: Probably the target version setting should be project dependent. Also, if you change the target version CB must be restarted in order to activate the changes. I hope this patch serves a first approach.

Not included are:
  wxEVT_SCROLL_ENDSCROLL, changed to wxEVT_SCROLL_CHANGED in 2.8.0
  wxEVT_STC_AUTOCOMP_COMPLETED, new in 3.1.1
  wxEVT_AUI_PANE_ACTIVATED, new in 2.9.4
  wxEVT_RIBBONGALLERY_CLICKED and wxEVT_RIBBONBAR_TAB_LEFT_DCLICK, new in 2.9.2
  wxEVT_DATAVIEW_CACHE_HINT, new in 2.9.1

oBFusCATed:
I don't like the idea of storing the version in the settings.
Can't you just generate the correct code with ifdefs for both versions?

Miguel Gimenez:
If you use #ifdefs you will see only events valid for the wxWidgets version used when compiling CB. In my case I am using CB compiled with wxWidgets 2.8.12 but I am developing using wxWidgets 3.1.0.

A possibility would be showing all known events and letting the compiler bark if you assign a handler to an invalid event.

cacb:
I think wxSmith should primarily target wxWidgets 3.x these days, and issue events corresponding to that, i.e. use the current wxEVT_GRID_CELL_CHANGED . Then when compiling against wx2.8 there could simply be a #define somewhere for backwards compatibility.

Perhaps something like this (when compiling an application, not when compiling C::B)


#if wxCHECK_VERSION(2, 8, 0)
#define wxEVT_GRID_CELL_CHANGED  wxEVT_GRID_CELL_CHANGE
#endif


I.e. it would be the responsibility of the application developer to stay compatible with outdated wxWidgets versions. The responsibility of wxSmith is then to stay up to date with latest stable release of wxWidgets.

I think this is cleaner.

stahta01:

--- Quote from: cacb on January 31, 2017, 03:59:52 pm ---I think wxSmith should primarily target wxWidgets 3.x these days, and issue events corresponding to that, i.e. use the current wxEVT_GRID_CELL_CHANGED . Then when compiling against wx2.8 there could simply be a #define somewhere for backwards compatibility.

Perhaps something like this (when compiling an application, not when compiling C::B)


#if wxCHECK_VERSION(2, 8, 0)
#define wxEVT_GRID_CELL_CHANGED  wxEVT_GRID_CELL_CHANGE
#endif


I.e. it would be the responsibility of the application developer to stay compatible with outdated wxWidgets versions. The responsibility of wxSmith is then to stay up to date with latest stable release of wxWidgets.

I think this is cleaner.

--- End quote ---

This is the solution that I think is easiest to create and maintain; just target the latest production wxWidgets (3.0.2) for code generation with an header file included for the prior production version(s).

Tim S.

 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version