News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

How to force UI editor to respect my change about class ?

Started by eranon, May 11, 2012, 01:36:35 AM

Previous topic - Next topic

eranon

Using C::B svn 7932 to manage a project using wxWidgets 2.8, I need a GUI without any title-bar nor system command (min/max/quit). So, rather than to subclass an existing class by myself, I've seen in the wxWidgets classes tree that wxSplashScreen could match my goal (even if exotic goal, I agree:).

Well, so I've taken this way and it works unless a little detail which bother me :

1) Using the CB's project wizard, I've created a wxFrame based project.
2) Replaced every "wxFrame" occurrence by "wxSplashScreen" in projects files (ie. in TestMain.h, TestMain.cpp and testframe.wxs).
3) Replaced "#include <wx/frame.h>" by "#include <wx/splash.h>" in TestMain.h, taking care to put-it out of "//(*Headers(elireFrame)//*)" block.

Then, all compile, link and run very well, but everytime I use wxSmith UI editor, C::B (or its wxSmith plugin) rewrites the "#include <wx/frame.h>" in TestMain.h and "<object class="wxFrame" name="TestFrame">" in testframe.wks. It doesn't break compile and running, but is embarrassing.

So, how to avoid this ? I mean, how to explain to the UI editor to respect my changes ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

renega_666

Auto generated code should not be edited by hand.


//(*
// auto generated code, should not be edited
//*)

// here you can add custom code


Anyway using a splash screen for a border-less window isn't a good idea.You only need to change the wxFrame style according to your needs.

eranon

Quote from: renega_666 on May 11, 2012, 09:06:30 AM
Auto generated code should not be edited by hand.

Thanks renega_666, but I didn't change anything in the autogenerated block as you can see below :

/(*Headers(TestFrame)
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/frame.h>
//*)
#include <wx/splash.h>

class TestFrame: public wxSplashScreen


So, knowing TestFrame class is based on wxSplashScreen and seeing frame.h is well provided, wxSmith/CB shouldn't regenerate reference to "frame.h" anymore. So, is there a difference of behavior between wxSmith and wxFormBuilder ?

QuoteAnyway using a splash screen for a border-less window isn't a good idea.You only need to change the wxFrame style according to your needs.

In this special case, yes, I agree, but it may exist cases where we need to go wild way (don't follow the standard)... And it can be important to be able to be not constraint by a tool (here, wxSmith). So, how, if I want to base an app on a class of mine using wxSmith ? Is that possible ? Or should I use wxFormBuilder rather ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

renega_666

QuoteThanks renega_666, but I didn't change anything in the autogenerated block as you can see below :

Code:
/(*Headers(TestFrame)
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/frame.h>
//*)
#include <wx/splash.h>

class TestFrame: public wxSplashScreen

So, knowing TestFrame class is based on wxSplashScreen and seeing frame.h is well provided, wxSmith/CB shouldn't regenerate reference to "frame.h" anymore. So, is there a difference of behavior between wxSmith and wxFormBuilder ?

I don't think wxSmith parse your source code (can anyone confirm this?) so it doesn't know that your class is a wxSplashScreen. I think it automatically rewrites all of its auto-generated source code whenever you make a change in the wxSmith editor panel.

Maybe this should be reported as a bug ???

QuoteIn this special case, yes, I agree, but it may exist cases where we need to go wild way (don't follow the standard)... And it can be important to be able to be not constraint by a tool (here, wxSmith). So, how, if I want to base an app on a class of mine using wxSmith ? Is that possible ? Or should I use wxFormBuilder rather ?

Except for the top level classes (such as wxFrame or wxDialog), you can specify a custom class using the Class name property (in the wxSmith's control property grid).

eranon

Quote from: renega_666 on May 11, 2012, 03:25:35 PM
QuoteCode:
/(*Headers(TestFrame)
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/frame.h>
//*)
#include <wx/splash.h>

class TestFrame: public wxSplashScreen

So, knowing TestFrame class is based on wxSplashScreen and seeing splash.h is well provided, wxSmith/CB shouldn't regenerate reference to "frame.h" anymore. So, is there a difference of behavior between wxSmith and wxFormBuilder ?

I don't think wxSmith parse your source code (can anyone confirm this?) so it doesn't know that your class is a wxSplashScreen. I think it automatically rewrites all of its auto-generated source code whenever you make a change in the wxSmith editor panel.

Maybe this should be reported as a bug ???

Why not ? Where are reported bug and/or feature requests about wxSmith plugin ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Jenna

It's not a bug, it's how wxSmith works.
The base class is also stored inside the project-file.

You can change it there with a text-editor, but I don't think it will work, because wxSplashScreen is not (/yet) supported by wxSmith as far as I know.

eranon

So, if it's a not a bug, it could be a smart feature to be able to manage this.
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]