* Calling function associated with a button
@ 2024-07-08 21:14 Heime
0 siblings, 0 replies; only message in thread
From: Heime @ 2024-07-08 21:14 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
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))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-07-08 21:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-08 21:14 Calling function associated with a button Heime
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.