On Mon, Jan 26, 2009 at 2:01 AM, Jesse Aldridge <[email protected]>wrote:

>
> When using the find by elimination stuff I find myself wishing I could
> hit f3 to jump between matches like you can with the normal find.  Any
> hints on how best to go about getting this functionality in the
> script?


You can bind any key to a command using @button or @command nodes.  We never
argue about key-bindings preferences.

Or, a better starting question might be, how do I jump to a
> given position in the body of a given node?


The typical code starts with::

    w = c.frame.body.bodyCtrl

This is a wrapper class around the underlying gui widget.  That is, w will
be a (subclass of)
@thin leoFrame.py--><< define text classes >>-->class baseTextWidget

In particular, you want to program to the following api:

@thin leoFrame.py--><< define text classes >>-->class baseTextWidget-->Must
be defined in subclasses (high-level interface)

So the answer to your question is::

    w = c.frame.body.bodyCtrl
    s = w.getAllText() # Optional, as an answer to this particular question.
    w.setInsertPoint(i)  # i is a zero-based offset into s.

An alternative is to use::

    w.setSelectionRange(i,j,insert=whatever)

HTH.

Edward

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to