[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Calling function associated with a button
From: |
Heime |
Subject: |
Calling function associated with a button |
Date: |
Mon, 08 Jul 2024 21:14:57 +0000 |
I want to have a set of buttons and labels (placed into three columns) that
execute particular functions when the buttons are pressed.
Things have been going well, except when I try making moped call the appropriate
entry in the functions lists (fc1-list, fc2-list, fc3s-list) for each button.
(defun moped (monbf fc1-list fc2-list fc3s-list lb1-list lb2-list lb3-list)
"Insert three lists of labels into BUFFER-NAME in three columns."
(with-current-buffer (get-buffer-create monbf)
(erase-buffer) ; Clear the buffer before inserting new labels
(insert "\n")
(let* ( (max-rows
(max (length lb1-list) (length lb2-list) (length lb2-list)))
(spx " ") ; Space following button
(kwd 13) ; Column Width
(zwd (+ kwd 4)) ) ; Empty Column Width
(dotimes (i max-rows)
(insert spx)
;;--------------------------------------------------------
(let ((lbv1 (nth i lb1-list)))
(if lbv1
(progn
(insert-button "[-]"
'action (lambda (b) (nth i fc1-list)))
(insert (format (format "%%s%%-%ds" kwd) spx lbv1)))
(insert (make-string zwd ?\s))))
;;--------------------------------------------------------
(let ((lbv2 (nth i lb2-list)))
(if lbv2
(progn
(insert-button "[-]"
'action (lambda (b) (nth i fc2-list)))
(insert (format (format "%%s%%-%ds" kwd) spx lbv2)))
(insert (make-string zwd ?\s))))
;;--------------------------------------------------------
(let ((lbv3 (nth i lb3-list)))
(if lbv3
(progn
(insert-button "[-]"
'action (lambda (b) (nth i fc3-list)))
(insert (format (format "%%s%%-%ds" kwd) spx lbv3)))
(insert (make-string zwd ?\s))))
;;--------------------------------------------------------
(insert "\n"))))
(pop-to-buffer monbf))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Calling function associated with a button,
Heime <=