Now I have a couple of questions about the usage of getArg().

The first argument, event, looks like something typical for widget
methods in context of binding them to user-generated events. I have a
grain of experience with wxPython and widget functions that match the
On*() pattern usually have an event argument. Since my goal is to
write a leo script, not a GUI app, I wonder where the manual play with
"event" fits in.

The handler argument has the meaning of a callback to me. At least by
looking at leo's source code, I can tell that if getArg() is called
from a class method, the handler specifies that one method (probably
to return to after getArg() does its job).

I have tried to look for examples of getArg() usage outside leo's
core. Grepping leoPlugins.leo and scripts.leo for "getArg" didn't find
anything.

So the current state of my script code is:

--- cut here ---
k = c.k
state_name = 'raw-input'
state = k.getState(state_name)
if state == 0:
    k.setLabelBlue('> ', protect = True)
    k.getArg(None, 'raw-input', 1)
else:
    k.clearState()
    g.es_print(k.arg)
--- cut here ---

I get the ">" prompt in the minibuffer. I'm able to input something.
But after pressing Enter I get "Raw-input Mode". The g.es_print() call
has no effect. I suppose the problem is the wrong call of getArg(),
but ATM I don't see the right way, so I have to ask about it.

Since I was pointed straight to the code, I could assume that the
answer to my original question can't be found by just reading leo's
docs (otherwise I would be probably redirected to the right chapter of
the manual). This and the fact that I didn't find any references to
getArg() in plugins and scripts makes me wonder if the reason is
because nobody needed yet to get interactive user input from a script.
Which is strange, because situations when interactive user input is
required, are rather generic.
--~--~---------~--~----~------------~-------~--~----~
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