Problem changing the find string in an open FindReplaceDialog

Assuming a wx.FindReplaceDialog has been created and displayed, how can the find string be dynamically replaced?

It seems that this code should do it, but it doesn't do anything:

        data = self.findDialog.Data
        data.FindString = 'TWO'
        self.findDialog.Data = data

following with either
        self.findDialog.Refresh()
or
        self.findDialog.Show(1)

doesn't do anything.

Python version 2.4.4
wxPython version 2.8.3.0

This causes a problem in SPE.
Thanks for any help.
-Rick King
Southfield MI USA

Rick King wrote:

Assuming a wx.FindReplaceDialog has been created and displayed, how can the find string be dynamically replaced?

It seems that this code should do it, but it doesn't do anything:

       data = self.findDialog.Data
       data.FindString = 'TWO'
       self.findDialog.Data = data

following with either
       self.findDialog.Refresh()
or
       self.findDialog.Show(1)

doesn't do anything.

SetData() doesn't update the values in the textctrls, (although I agree that it would make sense for it to do so,) it just sets the internal data pointer. You can update the textctrls by getting them from the dialog's GetChildren list and calling their SetValue.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Rick King wrote:

Assuming a wx.FindReplaceDialog has been created and displayed, how can the find string be dynamically replaced?

It seems that this code should do it, but it doesn't do anything:

       data = self.findDialog.Data
       data.FindString = 'TWO'
       self.findDialog.Data = data

following with either
       self.findDialog.Refresh()
or
       self.findDialog.Show(1)

doesn't do anything.

SetData() doesn't update the values in the textctrls, (although I agree that it would make sense for it to do so,) it just sets the internal data pointer. You can update the textctrls by getting them from the dialog's GetChildren list and calling their SetValue.

It seems that

    children = self.findDialog.GetChildren()

returns an empty list. It's as though there is another window that the dialog is creating that has all the children.

If I can get a list though, how do I know which one to call SetValue on? Or do I figure it out once by trial and error and then remember that for the future?

-Rick King
Southfield MI USA

Rick King wrote:

Rick King wrote:

Assuming a wx.FindReplaceDialog has been created and displayed, how can the find string be dynamically replaced?

It seems that this code should do it, but it doesn't do anything:

       data = self.findDialog.Data
       data.FindString = 'TWO'
       self.findDialog.Data = data

following with either
       self.findDialog.Refresh()
or
       self.findDialog.Show(1)

doesn't do anything.

SetData() doesn't update the values in the textctrls, (although I agree that it would make sense for it to do so,) it just sets the internal data pointer. You can update the textctrls by getting them from the dialog's GetChildren list and calling their SetValue.

It seems that

   children = self.findDialog.GetChildren()

returns an empty list.

Sorry, I forgot that wxMSW has a native version of this dialog and I was just looking at the generic version used on the other platforms.

You'll probably have to create a new dialog to be able to reset the values, however submitting a bug report about this might turn up some other answer.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!