On Thu, 15 Aug 2013 08:31:28 -0700 (PDT)
Fidel Pérez <[email protected]> wrote:

> Hey, got a quick question:
> 
> Following the documentation, Im trying to setup a simple hook, just 
> g.es("test") after I click a header.
> The code I have is:
> 
> def Headclick():
>     g.es("Header clicked")
> g.registerHandler('headclick2', Headclick)
> 
> I execute the code, but nothing will happen when I click a node. What is 
> wrong here?
> Thanks!
> 

I think you should be seeing some debugging output, if you have the
console window visible anyway.  The signature for a hook receiving
function is: http://leoeditor.com/scripting.html#event-handlers

def myHook (tag, keywords):
    whatever

so your code should be

def Headclick(tag, keywords):
    g.es("Header clicked")
g.registerHandler('headclick2', Headclick)

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to