From d791f16922517d42d668298fb437a4026f6c48b7 Mon Sep 17 00:00:00 2001 From: Rui Guo Date: Wed, 17 Jun 2009 21:46:25 +0800 Subject: [PATCH] Update the document about hook/unhook and input interface --- src/drafts/scripting | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/drafts/scripting b/src/drafts/scripting index b69bfec..9a1631c 100644 --- a/src/drafts/scripting +++ b/src/drafts/scripting @@ -251,9 +251,6 @@ D. Display Methods: ---------- -input - get input from user. - E. Screen @@ -275,14 +272,20 @@ or obj:hook(event, handler,[priv]) obj. If the obj is omitted, the event is a global event. An optional privilege can be specified through the priv parameter. The privilege determines the position of this handler in the chain. A smaller value has higher privilege. - This method returns a ticket (or handle) of the registration. This is used to - unregister the notification. -unhook(ticket, handler) -or obj:unhook(ticket, handler) - - Unregister the hook. The ticket and handler must match, otherwise a false is - returned. + This method returns a ticket (or handle) of the registration. This is used to + unregister the notification, using the syntax: ticket:unhook(). + +input(prompt, callback, [prefill]) + get input from user asynchronously with a callback. + This call returns immediately, with a input line poped up. The input prompt + is set to the first parameter and the buffer can be pre-filled with the third + parameter. Once the input is done with an enter, the callback function is + called with the inputed string to enable further process. + + The input happens at the active canvas of the current display. If there is no + current display input line appears in all canvas that shows the current + layer. FIXME!!! -------- Events: -- 2.11.4.GIT