I have several panel built using wxSmith. The panel was created by choosing 'add wxPanel' from wxSmith menu on codeblocks. The problem is that I give the name of the panel class with lowercase letter, e.g:
mypanelclass
I want to change it into:
MyPanelClass
I try to rename it manually (by replacing all mypanelclass with MyPanelClass) but didn't work because every time I edit the .wxs file the name will be reverted to the original setting.
thanks
wxSmith: how to rename an auto generated class Topic is solved
-
- In need of some credit
- Posts: 7
- Joined: Tue Apr 03, 2018 12:10 pm
-
- Part Of The Furniture
- Posts: 7481
- Joined: Sat Apr 16, 2005 7:22 am
- Location: USA, Ukraine
Re: wxSmith: how to rename an auto generated class
Hi,
Why do you want to change the wxs file?
Can't you just simply open the project, rename the class and save?
Thank you.
Why do you want to change the wxs file?
Can't you just simply open the project, rename the class and save?
Thank you.
-
- In need of some credit
- Posts: 7
- Joined: Tue Apr 03, 2018 12:10 pm
Re: wxSmith: how to rename an auto generated class
Hi,ONEEYEMAN wrote:Hi,
Why do you want to change the wxs file?
Can't you just simply open the project, rename the class and save?
Thank you.
1.because I need to add or remove or change the layout of the widgets on the panel. I am doing it by drag 'n droping widgets from pallete to the panel.
2.no. for example
this is mypanelclass.h:
Code: Select all
class mypanelclass : public wxPanel
{
protected:
static const long ID_STATIXTEZT7;//auto-generated code
.....
}
Code: Select all
...
const long mypanelclass::ID_STATIXTEZT7 = wxNewId();//auto-generated code
...
-
- Part Of The Furniture
- Posts: 7481
- Joined: Sat Apr 16, 2005 7:22 am
- Location: USA, Ukraine
Re: wxSmith: how to rename an auto generated class
Hi,
I understand that. But if you open the file in wxSmith and modify the design by renaming whatever you want then save the modified design everything should be in order.
Did you try that?
Thank you.
I understand that. But if you open the file in wxSmith and modify the design by renaming whatever you want then save the modified design everything should be in order.
Did you try that?
Thank you.
-
- In need of some credit
- Posts: 7
- Joined: Tue Apr 03, 2018 12:10 pm
Re: wxSmith: how to rename an auto generated class
I also thought that I should rename the class through the GUI designer (wxSmith). However I can't find a menu or anything in the designer editor to do it. Could you show me please?ONEEYEMAN wrote:Hi,
I understand that. But if you open the file in wxSmith and modify the design by renaming whatever you want then save the modified design everything should be in order.
Did you try that?
Thank you.
-
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
Re: wxSmith: how to rename an auto generated class
Hello,
If it's about a wxPanel based class of yours, you have a "Class name" field in wxSmith. If it's about an instance name rather than the class one, you have a field for variable name.
However, you can't rename all the classes from within the wxSmith's interface. For example, unless mistake, you can't rename the top window (wxFrame or wxDialog based)... But, in this case, you can simply rename all the concerned classname occurrences through you project files using a search & replace tool. It's what I do below: the wxFrame based class orginally named "wxSmith_testFrame" has been renamed as "MainFrame". Afterward I verified in wxSmith and it accepted the change (ie. there's no hidden checking like MD5 or something around the .wxs file format). The project is still consistent and build successfully after change too, of course!
If it's about a wxPanel based class of yours, you have a "Class name" field in wxSmith. If it's about an instance name rather than the class one, you have a field for variable name.
However, you can't rename all the classes from within the wxSmith's interface. For example, unless mistake, you can't rename the top window (wxFrame or wxDialog based)... But, in this case, you can simply rename all the concerned classname occurrences through you project files using a search & replace tool. It's what I do below: the wxFrame based class orginally named "wxSmith_testFrame" has been renamed as "MainFrame". Afterward I verified in wxSmith and it accepted the change (ie. there's no hidden checking like MD5 or something around the .wxs file format). The project is still consistent and build successfully after change too, of course!
You do not have the required permissions to view the files attached to this post.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
- In need of some credit
- Posts: 7
- Joined: Tue Apr 03, 2018 12:10 pm
Re: wxSmith: how to rename an auto generated class
Hi, eranon.
In my case 'mypanelclass' is the top widget/top window. So I can not rename the class from wxSmith's interface.
And as I said before I also have try to rename all class name occurences using search & replace tool (I call it as manual replacement). It works, however if I re-edit the panel GUI with wxSmith, the class names inside mypanelclass.cpp file will reverted to original class name.
have you try to re-edit the frame GUI?
In my case 'mypanelclass' is the top widget/top window. So I can not rename the class from wxSmith's interface.
And as I said before I also have try to rename all class name occurences using search & replace tool (I call it as manual replacement). It works, however if I re-edit the panel GUI with wxSmith, the class names inside mypanelclass.cpp file will reverted to original class name.
have you try to re-edit the frame GUI?
-
- Can't get richer than this
- Posts: 867
- Joined: Sun May 13, 2012 11:42 pm
- Location: France
Re: wxSmith: how to rename an auto generated class
Yes, I can still edit what I want in wxSmith after the change. In my opinion, if it reverts it could be because your missed some occurrences (for example, in the .wxs or .cbp files). You should avoid to do it manually. With a search & replace tool, the overall job is done in seconds.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
-
- In need of some credit
- Posts: 7
- Joined: Tue Apr 03, 2018 12:10 pm
Re: wxSmith: how to rename an auto generated class
Maybe you're right . I try to change the text more thoroughly with more specific options. And it works noweranon wrote:In my opinion, if it reverts it could be because your missed some occurrences (for example, in the .wxs or .cbp files).
Thank you