help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs forms input


From: Ilya Shlyakhter
Subject: Re: emacs forms input
Date: Wed, 4 Aug 2010 12:24:50 -0400

Thanks, that helps; but I was looking for something more: not simply
choosing a command from a menu,
but displaying a dialog with multiple fields, letting the user fill
some of them, and getting the result --
like displaying an HTML <FORM>.

Basically, I want the user to call an elisp function with many
possible optional arguments.
The standard elisp solution seems to be, "if called with one C-u
prefix, function does this;
if called with C-u C-u, it does that; ..." -- this is unintuitive and
quickly gets hard to remember.
In a GUI program I'd display a dialog box with multiple fields, with
some of them filled-in with
defaults, and let the user change the fields they want.  It seems that
ncurses should support that?
Does it?

thanks,

ilya

On Wed, Aug 4, 2010 at 7:55 AM, Teemu Likonen <address@hidden> wrote:
> * 2010-08-04 11:53 (+0300), Teemu Likonen wrote:
>
>> Now, if you want to abstract the implementation between graphical and
>> text interface it could be a function like this:
>>
>>     (defun my-dialog (title item-alist)
>>       (if (display-popup-menus-p)
>>           (x-popup-dialog t (cons title item-alist) nil)
>>         (let ((tmm-completion-prompt (concat title "\n\n")))
>>           (tmm-prompt (list "" (cons "" item-alist))))))
>
> Perhaps I should add that if you use C-g (keyboard-quit) or close the
> dialog box using window's close button that causes a quit signal and the
> function nor its callers won't return. Here's a new version which will
> catch the quit signal and, if that happens, return nil:
>
>    (defun my-dialog (title item-alist)
>      (condition-case nil
>          (if (display-popup-menus-p)
>              (x-popup-dialog t (cons title item-alist) nil)
>            (let ((tmm-completion-prompt (concat title "\n\n")))
>              (tmm-prompt (list "" (cons "" item-alist)))))
>        (quit nil)))
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]