Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Problem with wxSmith

(1/2) > >>

killerbot:
When I am designing my GUI of my plug-in, I am using the wxSmith to do this.
My dialog has a wxBoxSizer, which in turn contains a wxStaticBoxSizer.
My goals is to change the label at runtime of the staticBoxSizer (?if this is possible?), I first started out with constructs like :
   m_Comments = XRCCTRL(*this, "ID_TEXTCTRL_COMMENTS", wxTextCtrl)->GetValue();
This one is for a textctrl, but when I try this for the sizer it fails.

So , let's try to make it a member of the dialog and see what we can do then.
BUT when in wxSmith I make my wxBoxSizer (or my wxStaticBoxSizer) a member, wxSmith creates code in the constructor of the dialog like this :
    BoxSizer1 = XRCCTRL(*this,"",wxBoxSizer);
But that does not compile, I get the following error on that line :
Ccdialog.cpp:15: error: invalid static_cast from type `wxWindow*' to type `const wxBoxSizer*'


Bug in wxSmith or am I doing something wrong ?
I know that wxSizer does not derive from wxWindow, so maybe the whole construct created is illegal ?

Any ideas welcome,
many thanks,
Lieven

rickg22:
Yes, a sizer is an object *attached* to a wxWindow. You might find the wxWidgets manual useful. Also, try taking a look at some of the XRC files for codeblocks.

killerbot:
Conclusion is therefor : bug in wxSmith !

It should not generate code like this, or don'y even allow the sizer to be a member. Probably member might be ok, but other code to retrieve the object is needed.

byo:

--- Quote from: killerbot on November 01, 2005, 07:47:36 pm ---Conclusion is therefor : bug in wxSmith !

It should not generate code like this, or don'y even allow the sizer to be a member. Probably member might be ok, but other code to retrieve the object is needed.

--- End quote ---

This has already been fixed :)

Using XRC You can only get wxWindow-derived items. XRC headers doesn't even have macros for other objects (like sizers).
I see two solutions here:

* First is to use wxSmith's automatically generated code (without XRC file) but I guess it won't sattisfy You, or
* use GetSizer() to get wxStaticBoxSizer object from widget containing this sizer, next call GetStaticBox from this sizer and then try SetLabel() on wxStaticBox. It worked for me :)

killerbot:
Can we already download a new 'dll' binary with the fixes of wxSmith ?

Navigation

[0] Message Index

[#] Next page

Go to full version