On Jan 25, 2011, at 9:37 PM, Ricardo Araoz wrote:

> Working on a dEditor control. In the parent form I have this code in my
> search method:
> 
>    ed = self.Editor
>    start = 0
>    end = len(ed.Value)
>    srch = TxtToSearchFor
> 
>    selStart = ed.FindText(start, end, srch)
>    selEnd = selStart + len(srch)
>    ed.SelectionPosition = (selStart, selEnd)
> 
>    ed.setFocus()
> 
> This works, but I feel it's not elegant, OTOH in the command window I
> see a self.Editor.select(position, length) which says "Select all text
> from <position> for <length> or end of string.". When I try this in the
> commd wdw it selects nothing. I've looked in dEditor.py but was not able
> to find this edit() method.
> Is there a better way?
> Is there a "searchFor" method that manages the whole thing without me
> having to code the search form? (kind of what the dEditor.onPrint()
> method does)

        Sorry for not responding; this got lost in transit while I was away 
last week.

        dBaseMenuBar comes with a "Find / Replace" menu item that triggers the 
built-in wxPython find dialog. Selecting the menu calls the app's onEditFind() 
handler, which should do most of what you want.



-- Ed Leafe



_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/c6b21f84-f608-420c-a0e4-6c3434151...@leafe.com

Reply via email to