> --On 06/08/2012 9:10 PM, C M wrote:
> This has to be such a common need--is there one out there I've
> missed? If not, what's the basic logic of doing this? So far:
>
> 1. I've got the key_char of Ctrl-F recognized
> 2. I can open a FindDialog
> 3. I can find and select text in the textCtrl if I have a word
>
> I just am not sure how to go from 2 to 3 and so far I'm doing it
> wrong. How do I pass the text the user wants to find to step 3?
>
> Thanks,
> Che
> To unsubscribe, send email to wxPython-user...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-users?hl=en
You can either:
2a) get the text from the FindDialog when the user presses find, (or
ok), using yourDialog.GetText() or
2a) get the text from the FindDialog when the user presses find, (or
ok), using yourDialog.GetText() or
Tried that now. But:
AttributeError: 'FindReplaceDialog' object has no attribute 'GetText'
On Mon, Aug 6, 2012 at 3:53 PM, C M <cmpy...@gmail.com> wrote:2a) get the text from the FindDialog when the user presses find, (or
ok), using yourDialog.GetText() or
Tried that now. But:
AttributeError: 'FindReplaceDialog' object has no attribute 'GetText'
You can easily write one, adding it to your dialog class,
On 8/6/12 7:58 PM, C M wrote:
On Mon, Aug 6, 2012 at 10:38 PM, Josh English<joshua.r...@gmail.com <mailto:joshua.r.english@gmail.com>> wrote:
On Mon, Aug 6, 2012 at 3:53 PM, C M <cmpy...@gmail.com<mailto:cmpy...@gmail.com>> wrote:
2a) get the text from the FindDialog when the user presses
find, (or
ok), using yourDialog.GetText() or
Tried that now. But:
AttributeError: 'FindReplaceDialog' object has no attribute
'GetText'
You can easily write one, adding it to your dialog class,
Thanks, but I don't have (nor want) a custom dialog class. I'm using
wx.FindReplaceDialog, which is already made for just this purpose, is
native, etc. There must be a dirt simple way to get the search text
from this...?
Basically the opposite of how you put initial values into the dialog, using a wx.FindReplaceData object:
findData = flg.GetData()
text = findData.GetFindString()
Have you looked at the sample in the demo yet? As it shows you can bind the find events to the dialog. There is currently a bug on Windows (in current 2.9 releases at least) where the find text sent with the event is not being fetched properly, but you should be able to get it from the dialog itself in the event handler.
Try holding a reference to the data object so it isn't garbage collected. It looks like the find dialog is not taking ownership of it and is not copying it, so you need to make sure that it sticks around at least as long as the dialog does.