GitHubLionel from github has a repo for the modification to wxSmith.
See discussion here:
code with new wxSmith · Issue #14 · GitHubLionel/wxMathPlot
I think this is a nice feature we can use.
If the wxs file was opened by our normal wxSmith plugin, the generated code will be:
- nbConfig = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0);
- Panel1 = new wxPanel(nbConfig, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
+ nbConfig = new wxNotebook(this, ID_NOTEBOOK1, wxDefaultPosition, wxDefaultSize, 0, _T("ID_NOTEBOOK1"));
+ Panel1 = new wxPanel(nbConfig, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
So, its a nice feature to make the generated code more clean and compact.
A patch for the current wxSmith would be nice...
I have generated one, but it has more changes than expected and some regressions (like changing back nullptr to 0), probably because this changes were made after Lionel got the original code.
Diff:
I've created a proper patch against SVN head that acknowledges for the changes done in SVN in the meantime. I will have a look into it... But for the sake of better understanding: What is meant with "empty IDs"? I struggle to understand why this is useful?
Hi, morten, "empty IDs" means the wxWidgets controls has all the ID value = wxID_ANY. It does not need to create specific IDs such as ID_NOTEBOOK1, ID_NOTEBOOK2, ID_NOTEBOOK3. This make the generated code small and clean in case that we don't need to use those IDs in the future.
OK, probably a but nut-picking, but isn't that then "unspecific IDs"? Because even wxID_ANY is an ID. Probably its worth renaming the option.
And having that option enabled globally may require to override this in some controls where you may need the ID for some reason. OK for now - but I would love to see the override function, too - just to make it complete.
Seems to do what it should do. Therefore, applied in SVN [r13522] . Thank you!
Related
Commit: [r13522]
Hi, guys, this patch is nice, and now in our trunk, but when I'm trying to remove all the IDs from the wxSmith, I see that I can't remove them from menu items. But a quick test shows it could.
See my comments here:
https://github.com/GitHubLionel/wxMathPlot/issues/14#issuecomment-2149200427
Any ideas?
Thanks.