Entry
LISP: Allegro Franz Lisp: Microsoft:Windows: Program: Simple: Button: How write hello world program?
Jan 25th, 2004 14:52
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 25 January 2004 - 08:02 am --------------------
LISP: Allegro Franz Lisp: Microsoft:Windows: Program: Simple: Button:
How write hello world program?
---
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 'hello world' text, just add the following lines:
; 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' to "Hello world"
(setf (title mybutton) "Hello World")
5. -So all together that gives the following 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))
; 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' to "Hello world"
(setf (title mybutton) "Hello World")
t)
--- 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 'Hello world'
+-----------------------+
| |
| Hello World |
| |
+-----------------------+
---
---
Note:
This code is very similar to e.g. the way you first search for
a control in Borland Delphi, and then do something with it
when found.
---
Delphi: Component: Dynamic: Parameter: Pass: How to pass component
name as a parameter to a method?
http://www.faqts.com/knowledge_base/view.phtml/aid/24330/fid/175
----------------------------------------------------------------------