(loop for (id name some-field) in results-sql
do (let ((row (create-row table)))
(create-table-column :content id)
(set-on-click row (lambda (obj) (my-on-click obj id))))
(defun my-on-click (obj id)
(create-gui-window obj :title (format nil "Id: ~a" id)))
results-sql is a list of lists, returned by running an SQL statement.
However, it seems that whatever row I click on clog, I get the last id value in the results-sql list (looking at the window title). I analyzed in detail the clog-db-admin.lisp and I can't see any difference between my code. Would you have an idea why is this? I need the loop macro because I want to destructure the row.
Add a (my-id id) in the LET to make it part of the closure around set-on-click. I assume that using "id" from the macro is the issue. Let me know if that worked.
I have this pseudo-code:
results-sql
is a list of lists, returned by running an SQL statement.However, it seems that whatever
row
I click on clog, I get the lastid
value in theresults-sql
list (looking at the window title). I analyzed in detail theclog-db-admin.lisp
and I can't see any difference between my code. Would you have an idea why is this? I need theloop
macro because I want to destructure the row.