User forums > General (but related to Code::Blocks)

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

(1/2) > >>

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 ?

renega_666:
Auto generated code should not be edited by hand.


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

// here you can add custom code

--- End 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.
--- End quote ---

Thanks 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
--- End code ---

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 ?


--- Quote ---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.
--- End quote ---

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 ?

renega_666:

--- Quote --- Thanks 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 ?
--- End quote ---

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 ???


--- Quote ---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 ?
--- End quote ---

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 ---
--- Quote --- 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 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 ?
--- End quote ---

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 ???
--- End quote ---

Why not ? Where are reported bug and/or feature requests about wxSmith plugin ?

Navigation

[0] Message Index

[#] Next page

Go to full version