On Friday 29 August 2008 10:25:34 am Paul McNett wrote:
> johnf wrote:
> > def select(self, position, length):
> >             """ Select all text from <position> for <length> or end of 
> > string."""
> >             try:
> >                     self.SetInsertionPoint(1)
> >                     self.SetSelection(position, length)
> >             except AttributeError:
> >                     # Only works for text controls
> >                     pass
> >
> > If I attempt to use "select" from dDataContorlMixin.py as in
> > self.select(0,3)
> > I get an error
> > ItemContainer_SetSelection() takes exactly 2 arguments (3 given)
>
> Unfortunately, wxPython uses the SetSelection() method to mean different
> things in different contexts. For text controls, it means the selected
> text and takes pos, length args. For ItemContainer objects (like
> combobox, etc.) it means 'select the item at this index'.
>
> Can you try changing that to:
>
> def select(self, position, length):
>    try:
>      self.SetInsertionPoint(position)
>      self.SetInsertionPointEnd(length)
>    except AttributeError:
>      pass
>
> If it works, test that it doesn't break text controls, and then commit
> if good?
>
> If it doesn't work, we could at least catch TypeError as well as
> AttributeError and have the function do nothing.
>
> Paul
I will very shortly - need to feed some workers at my home.  Thanks for info 
on the different way's wx handles this.



-- 
John Fabiani


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to