[We can take this off the list if it's boring everyone else...]
> This solves a lot of my problems. Making ShowHelp overrides
work would make
> me highly happy,
>
>>behaviour. My current problem is that wxHelpProvider doesn't
>>inherit from
>>wxObject, which causes the following macro:
>>
>>IMPLEMENT_DYNAMIC_CLASS(wxPySimpleHelpProvider,
wxSimpleHelpProvider);
>>
Since it is not a wxObject then you don't need the dynamic
class stuff,
it is for the wxRTTI. wxPython only needs the wxRTTI in
order to create
instances of the right type for function return values, so it
won't hurt
anything in this case.
Are you sure? Thing is, I now have ShowHelp overridden, so that if I
subclass
wxSimpleHelpProvider in Python, and call ShowHelp on the same object, I get
the
subclass definition of ShowHelp, BUT when I pass it to wxHelpProvider_Set
and
then fetch it back with wxHelpProvider_Get, the overload is gone. It feels
like there has to be some dynamic class stuff going on so that the C++ code
knows to call the Python definition.
I'm going to nose into similar cases (thinking of wxTreeItemData being
passed
to wxTreeCtrl) to see if I can spot how this should be done.
So if you want to continue to try and get it working (sounds like you
are close) then I'll take a patch. If you can also provide
some use of
it in the demo I'll appreciate it.
wxTextCtrl has a method SetMaxLength(), which prevents a user from entering
more than a certain number of characters into the control. It works well.
wxGridCellTextEditor has a method SetParameters(). According to the
documentation, the parameter is "a number representing the maximum width". I
have assumed that this performs a similar function to SetMaxLength.
My assumption may be incorrect, in which case please ignore the rest of this
post, and advise whether there is a standard way of enforcing a maximum
length in a grid cell. It seems that I can write a custom cell editor to do
this, but I would prefer to avoid this if there is an easier method
available.
If my assumption is correct, I cannot get it to work. I want a common
maximum length to apply to an entire column, as all cells in the column will
contain the same kind of data. According to my understanding of the
documentation, you can associate a cell attribute with an entire column, and
you can associate a cell editor with a cell attribute, so I am trying to
combine these into one. This is what I have tried so far.
Since it is not a wxObject then you don't need the dynamic class
stuff, it is for the wxRTTI. wxPython only needs the wxRTTI in order to create instances of the right type for function return
values, so it won't hurt anything in this case.
Are you sure? Thing is, I now have ShowHelp overridden, so that if I subclass wxSimpleHelpProvider in Python, and call ShowHelp on the
same object, I get the subclass definition of ShowHelp, BUT when I
pass it to wxHelpProvider_Set and then fetch it back with
wxHelpProvider_Get, the overload is gone.
You're right. I forgot about the _Get. It's still possible, just more work. For an example take a look at the cell renderer and some of the other classes in grid.i. We can still get OOR to work with it but we'll have to change the C++ class to derive from wxClientDataContainer so we can store a reference to the Python object within it. Unfortunately that means that the change can't be done until 2.5 since there can be no binary incompatible changes to the core library in 2.4.
The plumbing for the overload can still be done without wxClientDataContainer, so any calls to ShowHelp (whether from C++ or from Python) will be redirected to the Python ShowHelp, you just won't get the original python instance back from the wxHelpProvider_Get function. Instead you'll get a new Python wxHelpProvider wrapper object wrapped around the same (original) C++ instance of wxPyHelpProvider.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
wxTextCtrl has a method SetMaxLength(), which prevents a user from entering
more than a certain number of characters into the control. It works well.
wxGridCellTextEditor has a method SetParameters(). According to the
documentation, the parameter is "a number representing the maximum width". I
have assumed that this performs a similar function to SetMaxLength.
Yes, that looks like what was supposed to happen but somebody dropped the ball, (there is a TODO comment about it in the code.) I'll see if it can be fixed for the next release.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!