[wxPython-users] Can FindReplace dialog have accelerator key?

Josiah Carlson jcarlson at uci.edu
Mon Sep 4 01:29:08 PDT 2006


jeremy alexander <jccfifkf at yahoo.com> wrote:
> 
> Hi Josiah,
> 
> Thanks for the tip about PyPE but I don't think it
> applies to what I am trying.  
> I'm using the standard wxFindReplaceDialog widget
> (pyPE doesn't seem to use the FindReplace dialog box).

You are correct, it doesn't use the dialog (for various reasons).

> The find loop in my application is using wxYield to
> allow window updates.  The dialog has a cancel button
> which when pressed kills the dialog.  I am trying to
> also implement an abort feature in which the find is
> stopped but the dialog remains.  The plan was to use
> an accelerator key (like 'Escape') which would result
> in an abort flag being set; the find loop would then
> monitor the flag.  

At least on Windows, I believe that the Find/Replace dialog is a native
control (or at least it was designed to look like the native control).
If you used the various pywin32 libraries to dig into it, you could
probably bind keys to functions. Alternatively, you could probably
re-write the dialog in about the same amount of time it would take to
figure out how to do pywin32 binding, and that dialog would work on any
platform.  Or, you could do a similar thing to what PyPE does and toss
the dialog into the trash (all it does is get in the way, floating over
what you are finding and replacing).

 - Josiah

> --- Josiah Carlson <jcarlson at uci.edu> wrote:
> 
> > 
> > jeremy alexander <jccfifkf at yahoo.com> wrote:
> > > 
> > > Hi,
> > > 
> > > I'm trying to add an accelerator key to a
> > findReplace
> > > dialog.  The reason is that the find operation can
> > > take a long time and I'd like to give users a
> > shortcut
> > > key to abort the find operation.  Is this
> > possible?
> > 
> > It is only really possible if your find/replace
> > operation can be
> > cancelled.  What is more likely than not is that
> > your find/replace is
> > occurring in the same thread as all of your GUI
> > handling code; and this
> > is likely going to be the case if you are
> > finding/replacing inside some
> > text control.
> > 
> > What I have personally done in PyPE is to only
> > find/replace up to 10
> > items at a time, then use wx.FutureCall(1, ...) to
> > schedule another call
> > to handle 10 more items in 1 ms.  This allows the
> > GUI to be redrawn, etc.
> > 
> > Alternatively, in the find case, I have put a call
> > to wx.Yield() in the
> > main loop of a 'find all' command, and checked the
> > status of a button
> > that determines whether the search should stop or
> > not.
> > 
> > The details of each of these are in findbar.py and
> > findinfiles.py inside
> > the PyPE source distribution available from
> > http://pype.sf.net .
> > 
> >  - Josiah
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > wxPython-users-unsubscribe at lists.wxwidgets.org
> > For additional commands, e-mail:
> > wxPython-users-help at lists.wxwidgets.org
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org





More information about the wxpython-users mailing list