Frame initialization
Paolo Amoroso
amoroso at mclink.it
Mon Aug 9 17:02:54 CEST 2004
In a frame, I am trying to automatically initialize the value of a
gadget based on the value of a frame slot at creation time. I use
code like this:
(in-package :clim-user)
(define-application-frame frame-init ()
((default-value :initarg :default :accessor default-value :initform nil))
(:panes
(text :text-field :value " "))
(:layouts
(default
(labelling (:label "Text field")
text))))
(defun init-default (frame)
(when (default-value frame)
(setf (gadget-value (find-pane-named frame 'text))
(default-value frame))))
(defmethod run-frame-top-level :before ((frame frame-init) &key)
(init-default *application-frame*))
If default-value is provided via the :default initarg at frame
creation, I would like the gadget to automatically get the same value.
If I understand correctly what I read, this approach should work:
*application-frame* is bound to the created frame, and the panes have
also been created. Instead, when evaluating a form such as:
(run-frame-top-level (make-application-frame 'frame-init :default "Paolo"))
I get this error (from the sldb buffer):
No matching method for the generic function
#<STANDARD-GENERIC-FUNCTION GOATEE::BUFFER (2) {2834A229}>, when called with
arguments (NIL).
[Condition of type PCL::NO-APPLICABLE-METHOD-ERROR]
Restarts:
0: [CONTINUE] Retry call to :FUNCTION.
1: [ABORT] Abort handling SLIME request.
2: [ABORT] Return to Top-Level.
Backtrace:
0: ("DEFMETHOD NO-APPLICABLE-METHOD (T)" #<#1=unused-arg> #<#1#>
#<STANDARD-GENERIC-FUNCTION GOATEE::BUFFER (2) {2834A229}> (NIL))
1: ((METHOD (SETF GADGET-VALUE) (:AFTER) (T TEXT-FIELD-PANE)) (#(67) . #())
#<unused-arg> "Paolo" #<TEXT-FIELD-PANE TEXT {580047ED}> ...)
2: ("LAMBDA (PCL::.KEYARGS-START. PCL::.VALID-KEYS. #:G4969 #:G4970 #:G4971)"
#<#1=unused-arg> #<#1#> "Paolo" #<TEXT-FIELD-PANE TEXT {580047ED}> ...)
3: ("LAMBDA (PCL::.KEYARGS-START. PCL::.VALID-KEYS. #:G6861 #:G6862 #:G6863)"
#<#1=unused-arg> #<#1#> #<FRAME-INIT {58000395}> NIL)
4: ((METHOD RUN-FRAME-TOP-LEVEL (:AROUND) (APPLICATION-FRAME))
(#(16 15) . #(#))
#S(PCL::FAST-METHOD-CALL
:FUNCTION #<Closure Over Function "LAMBDA (PCL::.KEYARGS-START. PCL::.VALID-KEYS. #:G6861 #:G6862 #:G6863)"
{58F3B729}>
:PV-CELL NIL
:NEXT-METHOD-CALL NIL
:ARG-INFO (1 . T))
#<FRAME-INIT {58000395}> NIL)
--more--
Where does the nil passed to goatee::buffer come from? Hasn't the
text gadget already been created when init-default is called? How can
I get the desired behavior?
Paolo
--
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
More information about the mcclim-devel
mailing list