Allegro SKILL Tutorial | Forms


In most situations you may need to create a form. The form then, in turn have check boxes and button which will trigger some action. In this tutorial we will create a simple "Hello" word form.

Copy the following code in a file form.il and save it in the directory C:/cadence/setup/skill (or the directory that allegro.ilinit points to).

 
axlCmdRegister( "helloform" `helloform)
; -----------------------------------------------------------------
; referencedesigner.com allegro skill tutorial
; creates a simple "hello world form"
; -----------------------------------------------------------------

procedure( helloform()
	hello_form = axlFormCreate( (gensym) "helloworld.form" nil nil t)
	axlFormDisplay(hello_form)

); end of procedure
; -----------------------------------------------------------------



What does this skill code do



The line

axlCmdRegister( "helloform" `helloform)
registers the command helloform ( as defined by the first argument. The second argument of the axlCmdRegister, also helloform tells the procedure that needs to be called when the command is given.

Look at the code

hello_form = axlFormCreate( (gensym) "helloworld.form" nil nil t) axlFormDisplay(hello_form)
The axlFormCreate creates a form defined in the helloworld.form and axlFormDisplay displayes it. Now you need to create another file - called helloworld.form with the following content.
 
FILE_TYPE=FORM_DEFN VERSION=2
FORM
FIXED
PORT 40 40
HEADER "Learning Form"

TILE
#======================

TEXT "Hello World ! - skill is easy with referencedesigner.com"
TLOC 1 1
ENDTEXT

#======================
ENDTILE

ENDFORM

Save the file in the same directory as you brd file. Assuming everything is right you can just type hello form at the Command and it will pop up a form.


Exercise


Change the line
PORT 40 40
to
PORT 60 40
and check that the width of the form increases.
Of course this form does not do any function. But it got you started on learning. In the next few pages we will be creating someting useful with the form.