is it possible to put a sizer object in a custom XmlResource object (like MyBluePanel in wxXmlResourceHandler demo)?
when i try to do this, i get wxPyAssertionError: C++ assertion "wxAssertFailure" failed in contrib\xrc\contrib\src\xrc\xh_sizer.cpp(147): Incorrect use of sizer: parent is not 'wxDialog', 'wxFrame' or 'wxPanel'.
my goal is a decorated panel in XRC file: wxPanel that contains some predefined controls and has an embedded panel that is parent for all contained XRC objects. i made a panel class and wxXmlResourceHandler for this, but passing the inner panel as a parent window to CreateChildren() produces the error shown above.
is it possible to put a sizer object in a custom XmlResource object (like MyBluePanel in wxXmlResourceHandler demo)?
when i try to do this, i get wxPyAssertionError: C++ assertion "wxAssertFailure" failed in contrib\xrc\contrib\src\xrc\xh_sizer.cpp(147): Incorrect use of sizer: parent is not 'wxDialog', 'wxFrame' or 'wxPanel'.
The wxCHECK that is failing is just doing simple object class name comparrisons, so as it is now it won't be allowed. Vaclav, would it make sense to loosen up this restriction a bit? For example it also won't allow a wxScrolledWindow...
The way around the for now is to still specify the class as wxPanel, but use the subclass attribute to name your custom panel class.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
is it possible to put a sizer object in a custom XmlResource object (like MyBluePanel in wxXmlResourceHandler demo)?
when i try to do this, i get wxPyAssertionError: C++ assertion "wxAssertFailure" failed in contrib\xrc\contrib\src\xrc\xh_sizer.cpp(147): Incorrect use of sizer: parent is not 'wxDialog', 'wxFrame' or 'wxPanel'.
The way around the for now is to still specify the class as wxPanel, but use the subclass attribute to name your custom panel class.
thank you. is there any documentation available about using subclasses in wxXmlResources? the only info i have found so far is your message on Pythoncard-users mailing list (november 2002) with example XRC using subclass...
is it possible to put values for subclass attributes in the XRC file?
The wxCHECK that is failing is just doing simple object class name
comparrisons, so as it is now it won't be allowed. Vaclav, would
it make sense to loosen up this restriction a bit? For example it
also won't allow a wxScrolledWindow...
As a matter of fact, this was already fixed this on the HEAD, but I
didn't realize it is a _real_ problem. Backported to WX_BRANCH_2_4
now.
my goal is a decorated panel in XRC file: wxPanel that contains some predefined controls and has an embedded panel that is parent for all contained XRC objects. i made a panel class and wxXmlResourceHandler for this, but passing the inner panel as a parent window to CreateChildren() produces the error shown above.
this works with updated xh_sizer.cpp (thanks Vaclav!)
but wxPython i've built from cvs does not seem to have unicode support: wxTextCtrl always shows characters from windows default codepage dependless of the language chosen, and also value returned from GetValue() is string, not unicode.
i took the following steps to buld wxPython:
- checked out wxWindows tag wxPy_2_4_1_2
- updated contrib/src/xrc/xh_sizer.cpp to r1.6.2.3.
- put expat-1.2 (version mentioned in contrib/src/xrc/README.EXPAT) sources into contrib/src/xrc/expat/
- fetched libunicows-0.6.3-msvc6.zip and put the .lib file on the library path. unicows.dll is in the python directory (installed by wxPythonWIN32-2.4.1.2u).
- created setup.h file as described in wxPython/BUILD.win32.txt
- in src/msw, ran 'nmake -f makefile.vc dll FINAL=hybrid UNICODE=1 MSLU=1'
- in wxPython, ran python setup.py HYBRID=1 UNICODE=1 install
- copied lib/wxmsw24uh.dll to \Pyton23\Lib\site-packages\wxPython. i am sure that wxPython uses this dll because when i move it away (or replace with one from wxPythonWIN32-2.4.1.2u-Py23.exe distribution), wxPython does not work.
The way around the for now is to still specify the class as wxPanel, but use the subclass attribute to name your custom panel class.
thank you. is there any documentation available about using subclasses in wxXmlResources? the only info i have found so far is your message on Pythoncard-users mailing list (november 2002) with example XRC using subclass...
The basic idea is that as far as XRC is concerned the class used is still the built-in class type and not the subclass. It just defers actual creation of the instance to a factory and then goes merily on its way assuming that it is the base class.
is it possible to put values for subclass attributes in the XRC file?
Not if they are specific to the subclass.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
The wxCHECK that is failing is just doing simple object class name
comparrisons, so as it is now it won't be allowed. Vaclav, would
it make sense to loosen up this restriction a bit? For example it
also won't allow a wxScrolledWindow...
As a matter of fact, this was already fixed this on the HEAD, but I didn't realize it is a _real_ problem. Backported to WX_BRANCH_2_4 now.
Thanks!
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
but wxPython i've built from cvs does not seem to have unicode support: wxTextCtrl always shows characters from windows default codepage dependless of the language chosen, and also value returned from GetValue() is string, not unicode.
i took the following steps to buld wxPython:
- checked out wxWindows tag wxPy_2_4_1_2
- updated contrib/src/xrc/xh_sizer.cpp to r1.6.2.3.
- put expat-1.2 (version mentioned in contrib/src/xrc/README.EXPAT) sources into contrib/src/xrc/expat/
- fetched libunicows-0.6.3-msvc6.zip and put the .lib file on the library path. unicows.dll is in the python directory (installed by wxPythonWIN32-2.4.1.2u).
- created setup.h file as described in wxPython/BUILD.win32.txt
I don't think I mentioned in the build doc the unicode settings in setup.h, did you set them? (My own build process automatically sets all combinations of wxUSE_UNICODE and wxUSE_UNICODE_MSLU and some other flags, so it's easy to forget...)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
I don't think I mentioned in the build doc the unicode settings in setup.h
no, you didn't.
did you set them?
no, i didn't. it's silly, but i expected make variables UNICODE and MSLU to do the trick.
it works now. thanks a lot! it's hard to express how much pleasure i get from wxPython, for about four years now. it is a really great thing. thank you!
by the way, do you know that files xxx.py and tree.py in directory wxPython/wxPython/tools/XRCed have extra CRs? (i.e. windows files were committed from *nix.) compilation to .pyc in python2.3 reports "SyntaxError: invalid syntax" at the end of these files, so i had to remove these CRs to make 'setup.py install' pass.