El 03/02/11 16:55, Ed Leafe escribió:
> 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.

Thanks Ed,
 for the present case this will work. Just use the dBaseMenuBar and
modify it to my needs.
But I can imagine a couple of scenarios where this would not be enough.
    i - say I want to do the search stuff from a button (guess the
answer to this would be to just call the menu onHit or something)
    ii - I might need to define my own findDialog and/or do funny things
with the found text.

In those cases I imagine it would be nice to be able to call a find
method with the appropriate parameters (findString, downwardSearch,
wholeWord, matchCase) which would return the position of the text. I
guess I could, if necessary, drill down to uiApp, set the appropriate
findReplaceData flags and directly use onFind() but it would be a hack.
Anyway, just a suggestion, right now I'm ok with using a dBaseMenuBar.

_______________________________________________
Post Messages to: [email protected]
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/[email protected]

Reply via email to