开发者

Change an editable-text value in Allegro CL

I'm trying to change the value of an Editable-Text control in Allegro CL (version 8.0.1) by clicking a Default-Button.

I've read about (setf value) but haven't found any examples.

The function I have ttached to the on-click event is the following

    (defun form1-default-button-2-on-click (dialog widget)
       (declare (ignorable dialog widget))

    t)

As you can see there's a lack of code in there :) I've tried various methods as (setf (slot value :txt 'value) 'TEXT) and (setf value 'TEXT) but to no avail.

The dialog-items slot on the form is a list with the following elements defined by

(list (make-instance 'default-button :font
                   (make-font-ex nil "S开发者_如何学JAVAegoe UI / Default" 12) :left
                   56 :name :default-button-2 :on-change
                   'form1-default-button-2-on-change :top 36)
    (make-instance 'editable-text :font
                   (make-font-ex nil "Segoe UI / Default" 12) :left
                   52 :name :txt :top 152 :value "")
 )

Any help? Thanks in advance.


(setf (slot-value widget 'value) "foo")

Something like the above. You need get the symbol value in the correct package. probably there is also an accessor function like WIDGET-VALUE . Then (setf (widget-value widget) "foo") might work...

I'm not an ACL user - there are probably better ways. ACL specific questions are best asked on their users mailing list.


There is an example somewhere on franz.com where I found this:

(defun form1-button5-on-change (widget new-value old-value)
  (declare (ignorable widget new-value old-value))
  (let ((szerkeszto (find-sibling :multi-line-editable-text-1 widget)))
    (setf (value szerkeszto) "bla" ))
  t) ; Accept the new value

symbol "szerkeszto" becomes the multi-line-editable-text-1, then you can use setf like the above to set appropriate attributes (like "value").

hope this helps.


You need to use the functions "find-component" and "value" together.

The function "find-component" finds the widget in your project and "value" returns the value of the widget.

If you have static-text in a form, you can change the value of the static-text like this.

(let ((ed1 (find-component :static-text-1 :form1))) (setf (value ed1) "I made it."))

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜