Entry
LISP: Allegro Franz Lisp: Microsoft: Windows: Button: Simple: How to write program, which assigns 3?
Jan 25th, 2004 14:53
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 25 January 2004 - 09:32 pm --------------------
LISP: Allegro Franz Lisp: Microsoft: Windows: Button: Simple: How to
write program, which assigns 3?
---
Steps: Overview:
1. -Create a new application
1. Run Allegro Lisp
2. -Put a button on the form
1. Click once on the leftmost button on the palette
2. Click once on the form
3. That will place a button on the form
3. -Put some code in the event for this button
1. Double click on the button
2. -click button 'Events'
in the 'Inspect' window
3. -Double click on the 'On click' event line
4. -That will add some default code
--- cut here ---------------------------------------------------------
;; Code for the dialog :form1
(in-package :common-graphics-user)
(defun form1-button4-on-click (dialog widget)
(declare (ignore-if-unused dialog widget))
t)
--- cut here ---------------------------------------------------------
4. -To show the value (so you set 'x=3', then show 'x' on the title
of the button, just add the following lines:
; this is equivalent to 'x=3'
; tried also to use ( = x 3 )
(setq x 3)
; first search for the button4 in the existing controls,
; and assign this to a variable
(setq mybutton (find-component :button4 (parent widget)))
; then set its property 'title'
(setf (title mybutton) x)
5. -So all together that gives the following code:
--- cut here ---------------------------------------------------------
(defun form1-button4-on-click (dialog widget)
(declare (ignore-if-unused dialog widget))
(setq x 3)
; first search for the button4 in the existing controls,
; and assign this to a variable
(setq mybutton (find-component :button4 (parent widget)))
; then set its property 'title'
(setf (title mybutton) x)
--- cut here ---------------------------------------------------------
6. -Run this code
1. Click on the '>' in the menu
2. Ignore the possible warning, by clicking he
3. Then click on the button
1. It will change its title to '3'
+-----------------------+
| |
| 3 |
| |
+-----------------------+
----------------------------------------------------------------------