Mercurial > emacs
comparison lisp/wid-edit.el @ 18429:8326843eefd9
(widget-edit-hook): New variable.
(widget-field-action, widget-choice-action): Run that hook
instead of displaying an echo area message.
(widget-toggle-action): Likewise.
(group-visibility, widget-group-visibility-create):
Moved to cus-edit.el and renamed.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 24 Jun 1997 03:17:34 +0000 |
parents | 201d766770fd |
children | 947c1b6ea8de |
comparison
equal
deleted
inserted
replaced
18428:5ec58687160a | 18429:8326843eefd9 |
---|---|
1714 (history (widget-get widget :prompt-history))) | 1714 (history (widget-get widget :prompt-history))) |
1715 (let ((answer (widget-apply widget | 1715 (let ((answer (widget-apply widget |
1716 :prompt-internal prompt initial history))) | 1716 :prompt-internal prompt initial history))) |
1717 (widget-apply widget :value-to-external answer)))) | 1717 (widget-apply widget :value-to-external answer)))) |
1718 | 1718 |
1719 (defvar widget-edit-hook nil) | |
1720 | |
1719 (defun widget-field-action (widget &optional event) | 1721 (defun widget-field-action (widget &optional event) |
1720 ;; Move to next field. | 1722 ;; Move to next field. |
1721 (widget-forward 1) | 1723 (widget-forward 1) |
1722 (message "To set the value, invoke [State] and choose the Set operation")) | 1724 (run-hooks 'widget-edit-hook)) |
1723 | 1725 |
1724 (defun widget-field-validate (widget) | 1726 (defun widget-field-validate (widget) |
1725 ;; Valid if the content matches `:valid-regexp'. | 1727 ;; Valid if the content matches `:valid-regexp'. |
1726 (save-excursion | 1728 (save-excursion |
1727 (let ((value (widget-apply widget :value-get)) | 1729 (let ((value (widget-apply widget :value-get)) |
1913 (widget-value-set widget | 1915 (widget-value-set widget |
1914 (widget-apply current :value-to-external | 1916 (widget-apply current :value-to-external |
1915 (widget-get current :value))) | 1917 (widget-get current :value))) |
1916 (widget-setup) | 1918 (widget-setup) |
1917 (widget-apply widget :notify widget event))) | 1919 (widget-apply widget :notify widget event))) |
1918 (message "To set the value, invoke [State] and choose the Set operation")) | 1920 (run-hooks 'widget-edit-hook)) |
1919 | 1921 |
1920 (defun widget-choice-validate (widget) | 1922 (defun widget-choice-validate (widget) |
1921 ;; Valid if we have made a valid choice. | 1923 ;; Valid if we have made a valid choice. |
1922 (let ((void (widget-get widget :void)) | 1924 (let ((void (widget-get widget :void)) |
1923 (choice (widget-get widget :choice)) | 1925 (choice (widget-get widget :choice)) |
1969 | 1971 |
1970 (defun widget-toggle-action (widget &optional event) | 1972 (defun widget-toggle-action (widget &optional event) |
1971 ;; Toggle value. | 1973 ;; Toggle value. |
1972 (widget-value-set widget (not (widget-value widget))) | 1974 (widget-value-set widget (not (widget-value widget))) |
1973 (widget-apply widget :notify widget event) | 1975 (widget-apply widget :notify widget event) |
1974 (message "To set the value, invoke [State] and choose the Set operation")) | 1976 (run-hooks 'widget-edit-hook)) |
1975 | 1977 |
1976 ;;; The `checkbox' Widget. | 1978 ;;; The `checkbox' Widget. |
1977 | 1979 |
1978 (define-widget 'checkbox 'toggle | 1980 (define-widget 'checkbox 'toggle |
1979 "A checkbox toggle." | 1981 "A checkbox toggle." |
2629 (setq off "")) | 2631 (setq off "")) |
2630 (if (widget-value widget) | 2632 (if (widget-value widget) |
2631 (widget-glyph-insert widget on "down" "down-pushed") | 2633 (widget-glyph-insert widget on "down" "down-pushed") |
2632 (widget-glyph-insert widget off "right" "right-pushed")))) | 2634 (widget-glyph-insert widget off "right" "right-pushed")))) |
2633 | 2635 |
2634 (define-widget 'group-visibility 'visibility | |
2635 "An indicator and manipulator for hidden group contents." | |
2636 :create 'widget-group-visibility-create) | |
2637 | |
2638 (defun widget-group-visibility-create (widget) | |
2639 (let ((visible (widget-value widget))) | |
2640 (if visible | |
2641 (insert "--------"))) | |
2642 (widget-default-create widget)) | |
2643 | |
2644 ;;; The `documentation-link' Widget. | 2636 ;;; The `documentation-link' Widget. |
2645 ;; | 2637 ;; |
2646 ;; This is a helper widget for `documentation-string'. | 2638 ;; This is a helper widget for `documentation-string'. |
2647 | 2639 |
2648 (define-widget 'documentation-link 'link | 2640 (define-widget 'documentation-link 'link |