CAPI questions
I haven't done a lot with CAPI in the past, and now making my first (real) app using it, I'm running into (what should be simple) issues I'm hoping a couple people here might be able to assist with.I have a subclass of row-layout that is going to be added to a column-layout. It looks like this:
+------------+
| +--+-----+ |
| | | | |
| +--+-----+ |
| |
| +--+-----+ |
| | | | |
| +--+-----+ |
+------------+
Now, I'd like something to happen whenever the user clicks on a row item in the column layout. I don't want to have to try and put the same callback handler in every child element of the row-layout instead of just having a single handler at the row-layout level. However, I can't seem to see any way of adding any input callbacks to the row-layout. Is this possible? Also, I'm assuming that by *not* having input callbacks in the child elements that they won't eat the message before the layout gets a crack at it. Is this a valid assumption or would I need to do more?
Next, I have a background thread that's actually accumulating the data that will be used to create each of the rows. As each item is collected it's added to an mp:mailbox object. I currently have a function (running in another thread) that loops until the mailbox is empty and creates each of the items, pushing it into the description of the column-layout.
(defun update-rows (mb pane)
(with-slots (all-rows)
pane
(flet ((make-row ()
(let* ((item (mailbox-read mb))
(row (make-instance 'row-layout ...)))
(push row (layout-description column-layout)))))
(loop
:until (mailbox-empty-p mb)
:do (apply-in-pane-process pane #'make-row)))))
If there are even a few items in the mailbox, this totally locks up/crashes the IDE on OS X. On Windows (for which I only have the personal edition to work with) the heap quickly fills and the IDE closes, which doesn't make sense given how dead simple the interface I'm building is.
If I take out the loop and do an (unless empty make-row) form, it works (on both platforms) and I can repeatedly call this function myself over and over with no problems. Can anyone see something obvious that I'm just doing wrong here?
As a work-around, if I do (apply-in-pane-process ... #'update-rows), then everything is fine, but if there are a large number of rows to be added then the interface is essentially frozen while it adds them, which is what I wanted to avoid.
Thanks for any replies/insights!
Jeff M.