Sorry for what might be either a Stupid Newbie Question or Pilot Error:
I am trying to implement a frame that allows "form-like" pop-editing of a CL data structure which include strings. How can I initialize the text fields and text editors?
If I do what seems like the recommended thing according to the Harlequin CLIM manual -- a :before method on run-frame-top-level, it seems like maybe some goatee buffer pointer is not initialized until after the primary run-frame-top-level method gets called.
(I made my own :around run-frame-top-level method, and the setf gadget-value, in fact, succeeds after the (call-next-method) has run -- but of course that's a little late for me.)
The attached lisp program seems to exhibit the symptoms: the "test1" command works as expected and sets the value, but the :before method does not seem to.
I only tried this under Linux (CentOS 4.4) on a relatively recent SBCL (0.9.14 RPM), using a relatively recent McCLIM (CVS updated approx Sept 15th). If anybody would please suggest further experiments, I would carry them out post-haste.
Sorry if this is a stupid mechanical question: also, is there a stylistically better way to do this?
Thanks,
-jm
"John" == John Morrison jm@mak.com writes:
John> Sorry for what might be either a Stupid Newbie Question or John> Pilot Error:
John> I am trying to implement a frame that allows "form-like" John> pop-editing of a CL data structure which include strings. John> How can I initialize the text fields and text editors?
John> If I do what seems like the recommended thing according to John> the Harlequin CLIM manual -- a :before method on John> run-frame-top-level, it seems like maybe some goatee buffer John> pointer is not initialized until after the primary John> run-frame-top-level method gets called.
John> (I made my own :around run-frame-top-level method, and the John> setf gadget-value, in fact, succeeds after the John> (call-next-method) has run John> -- but of course that's a little late for me.)
John> The attached lisp program seems to exhibit the symptoms: the John> "test1" command works as expected and sets the value, but John> the :before method does not seem to.
John> I only tried this under Linux (CentOS 4.4) on a relatively John> recent SBCL (0.9.14 RPM), using a relatively recent McCLIM John> (CVS updated approx Sept 15th). If anybody would please John> suggest further experiments, I would carry them out John> post-haste.
John> Sorry if this is a stupid mechanical question: also, is John> there a stylistically better way to do this?
Argh. I wish I could answer you precisely. I remember only vaguely reading something in the CLIM spec that said "this is the method to specialize if you want to set up your frame (or something like that)."
IIRC, it's ADOPT-FRAME to which you want to add this behavior.
Good luck!
r
| I only tried this under Linux (CentOS 4.4) on a relatively recent SBCL | (0.9.14 RPM), using a relatively recent McCLIM (CVS updated approx | Sept 15th). If anybody would please suggest further experiments, I | would carry them out post-haste.
Assuming you really meant this (whre INSTANCE is used instead of FRAME in (find-pane-named ...)
(defmethod run-frame-top-level :before ((instance test-frame) &key) (setf (gadget-value (find-pane-named instance 'tester)) "this doesn't"))
This does what you expected in Lispworks CLIM. I've used this sort of initialization many times.
Paul
On Friday 29 September 2006 18:38, Paul Werkowski wrote:
Assuming you really meant this (whre INSTANCE is used instead of FRAME in (find-pane-named ...)
(defmethod run-frame-top-level :before ((instance test-frame) &key) (setf (gadget-value (find-pane-named instance 'tester)) "this doesn't"))
Doh!
Even so, when fixing it as you kindly indicated, it still bombs -- please see attached updated foo.lisp and a log file containing a backtrace...
-jm
Even so, when fixing it as you kindly indicated, it still bombs --
The Goatee editable area object, which contains the buffer, is not initialized until the first redisplay happens, so it is impossible to access the buffer before then. Hence, you cannot use (setf gadget-value) on a text-field or text-editor gadget in McCLIM before your command loop is running and the gadget has been redisplayed at least once. I'm pretty sure this is a bug in McCLIM (if anyone wants to fix it, look at the definition of `handle-repaint' for `text-field-pane' in gadget.lisp line 2542).
On Friday 29 September 2006 19:38, Troels Henriksen wrote:
The Goatee editable area object, which contains the buffer, is not initialized until the first redisplay happens, so it is impossible to access the buffer before then. Hence, you cannot use (setf gadget-value) on a text-field or text-editor gadget in McCLIM before your command loop is running and the gadget has been redisplayed at least once. I'm pretty sure this is a bug in McCLIM (if anyone wants to fix it, look at the definition of `handle-repaint' for `text-field-pane' in gadget.lisp line 2542).
DREI obviates this problem. So a double "thank you" is owed by me to you. Thanks, doubly!
-jm