[cells-gtk-devel] making a text-buffer inputp

Peter Denno peter.denno at nist.gov
Fri May 13 21:53:31 UTC 2005


On Friday 13 May 2005 17:41, Jonathan Heusser wrote:
> Forgive my very newbie question.

No problem.

> I'm trying to change a text-buffer to the value of an entry with a click
> on a button.
>
> My button code looks like this:
> (mk-button :md-name :b :label "send" :on-clicked
>                 (callback (w e d)
>                   (setf (buffer (upper self buttons))
>                     (md-value (fm-other :entry))))
>
> After pressing enter on this button I got the error that the buffer has
> to be initialized as inputp.
> Then I tried to initialize it as follows (it was just a guess):
>  (buffer :accessor buffer :initarg :buffer
>
>        :initform (c-input () (mk-text-buffer
>        :
>               :text (format nil "bla"))

I think you want :text (c-in "bla") here. 

Here is an example, from my code (it will work with a little editing).
Also, I think there is a demo thing that adds text to a buffer.

(defmodel |BACKGROUND OUTPUT| (vbox)
  ()
  (:default-initargs
      :kids
      (list 
       (mk-vbox :expand t :fill t
        :kids
        (list 
         (mk-button :label "Clear"
                    :on-clicked 
                    (callback (w e d) 
                      (setf (text (buffer (unique-widget :backout-text))) 
(format nil "~A" (gensym)))))
         (mk-scrolled-window 
          :kids
          (list 
           (mk-text-view 
            :md-name :backout-text 
            :buffer (mk-text-buffer 
                     :tag-table (list
                                 :red-foreground :red-background :yellow-foreground :yellow-background
                                 :green-foreground :green-background :blue-foreground :blue-background
                                 :black-foreground :black-background :white-foreground :white-background)
                     :text (c-in ""))))))))))



>
> But it's still not working as it should. Either my setf on the buffer is
> wrong or this initialisation.
> Can you lead me on the right track?
>
> Thanks
> Jonathan Heusser

-- 
- Best regards,
   Peter



More information about the cells-gtk-devel mailing list