allegro skill表单学习笔记
表单
表单操作流程
- 打开表单:axlFormCreate
- 初始化Field:axlFormSetField
- 显示表单:axlFormDisplay
- 用户交互:axlFormCallback
- 关闭表单:axlFormClose
表单格式
FILE_TYPE=FORM_DEFN VERSION=2
FORM [form_options]
formtype ; FIXED | VARIABLE
; Skill only supports FIXED form types
PORT w h ; 设置表单的宽度(w)和高度(h)
HEADER "text" ; 设置表单title
; form_header
[{default_button_def}]
[{popup_def}]
[{message_def}]
{tile_def}
ENDFORM
表单选项
form_options:
[TOOLWINDOW]
- This makes a form a toolwindow which is a floating toolbar. It is typically used as a narrow temp window to display readouts.
[FIXED_FONT]
- By default, forms use a variable width font. This option sets the form to use a fixed font. Allegro/Apd use mostly variable width while SPECCTRAQuest and SigXP use fixed width fonts.
[AUTOGREYTEXT]
- When a fillin or enum control is greyed, grey static text to the left of it.
[UNIXHGT]
- Works around a problem with Mainsoft in 15.0 where a button is sandwiched vertically between 2 combo/fillin controls. The button then overlaps these controls. This adds extra line spacing to avoid this. You should only use this option as a last resort. In a future release, it may be treated as a Nop. On Windows, this is ignored.
Button定义
default_button_def:
DEFAULT <label>
- Sets the default button to be <label>. If not present, the form sets the default button to be one of the following: ok (done), close, or cancel.
- Label must be of type MENU BUTTON.
POPUP定义
popup_def:
POPUP <<popupLabel>> {"<display>","<dispatch>"}.
- Popups may be continued over several lines by using the backslash (\) as the last character on a line.
dispatch
- string that is dispatched to the code.
display
- string that is shown to user
Message定义
message_def:
MESSAGE messageLabel messagePriority "text"
messageLabel:
- Name used to allow code to refer to messages.
- Case insensitive.
messagePriority:
- Message priority
0 - (not in journal file),
1 - information,
2 - warning,
3 - error,
4 - fatal (display in message box)
TILE定义
ILE [<tileLabel>]
[TPANEL tileType]
[{text_def}]
[{group_def}]
[{field_def}]
[{button_def}]
[{grid_def}]
[{glex_def}]
ENDTILE
tileLabel:
- Name used to allow code to refer to this tile.
- Should use lower case.
- Only applies to VARIABLE forms.
- Not supported with AXL forms.
tileType [0|1|2]
- 0 top tile, 1 scroll tile, 2 bottom tile
- Only applies to VARIABLE FORMS.
- Region where tile will be instantiated. Forms have the following regions: top, bottom, and scroll (middle).
- Not supported with AXL forms.
TABSET定义
TABSET [label]
[OPTIONS tabsetOptions]
FLOC x y
FSIZE w h
{tab_def}
ENDTABSET
tabsetOptions:
[tabsetDispatch]
- By default, tabsets dispatch individual tabs as seperate events.
This is not always convenient for certain programming styles.
This changes the dispatch mode to be upon the tabset where a selection of a tab causes the event: field=tabsetLabel value=tabLabel
The default is:
field=tabLabel value=t
Script record/play remains based upon tab in either mode.
实例
TABSET "tabset"
OPTIONS tabsetDispatch
FLOC 0 0
FSIZE 100 50
ENDTABSET
TAB定义
TAB "<display>" [<label>] (10)
[{text_def}]
[{group_def}]
[{field_def}]
[{grid_def}]
ENDTAB
文本定义
TEXT "display" [label] (9)
FLOC x y
[FSIZE w h] (8)
text_type
[OPTIONS textOptions]
ENDTEXT
文本类型:
[INFO label w] |
; label:
; - Name used to access a field from code. All fields should have unique names.
; - Labels should be lower case.
[THUMBNAIL [<bitmapFile>|#<resource>] ]
; bitmapFile:
; - Name of a bmp file. Finds the file using BITMAPPATH
; resource:
; - Integer resource id (bitmap must be bound in executable via the resource file). '#' indicates it is a resource id.
; - Not supported in AXL forms.
文本选项:
textOptions:
[RIGHT | CENTER | BORDER | BOLD | UNDERLINE]
- TEXT/INFO field type
- text justification, default is left
- BORDER: draw border around text
[STRETCH]
- THUMBNAIL field type
- Stretch bitmap to fit thumbnail rectangle, default is center bitmap.
GROUP定义
GROUP "display" [label] (9)
FLOC x y
FSIZE w h (8)
[INFO label]
ENDGROUP
label定义:
label:
- Name used to access a field from code. All fields should have unique names.
- Labels should be lower case.
FIELD定义
FIELD label
FLOC x y
[FSIZE w h] (8)
field_type
field_options
ENDFIELD
label定义:
label:
- Name used to access a field from code. All fields should have unique names.
- Labels should be lower case.
FIELD类型:
REALFILLIN w fieldLength |
LONGFILLIN w fieldLength |
STRFILLIN w fieldLength |
INTSLIDEBAR w fieldLength |
ENUMSET w [h] | (11)
CHECKLIST "display" ["radioLabel"] |
LIST "" w h |
TREEVIEW w h |
COLOR w h |
THUMBNAIL [<bitmapFile>|#<resource>] |
PROGRESS w h
TRACKBAR w h
FIELD选项:
[INFO_ONLY]
- sets field to be read only.
[POP "<popupName>"]
- assigns a popup with the field.
- a POPUP definition by the same name should exist.
- supported by field_types: xxxFILLIN, INTSLIDEBAR, MENUBUTTON,
ENUMSET
[MIN <value>]
[MAX <value>]
- assigns a min and/or max value that field might have.
- both supported by field_types: LONGFILLIN, INTSLIDEBAR, REALFILLIN.
- value by either by an interger or floating point number.
[DECIMAL <accuracy>]
- assigns a floating min and/or max value that field might have.
- assigns number of decimal places field has (default is 2)
- both supported by field_types: REALFILLIN
[VALUE "<display>"]
- initial field value.
- supported by field_types: xxxFILLIN
display:
- String that is shown to the user.
[SORT]
- alphanumberic sorted list (default order of creation)
- supported by field_type: LIST
[OPTIONS dispatchsame]
- for enumset fields only.
- if present will dispatch to application drop-down selection even if the same as current. By default, the form's package filters out any user selection if it is the same as what is currently displayed.
dispatch:
- String that is dispatched to the code.
[OPTIONS prettyprint]
- for enumset fields only
- displays contents of ENUM field in a visually pleasing way
[OPTIONS ownerdrawn]
- for enumset fields only
- used to display color swatches in an ENUM field. See axlFormBuildPopup.
FIELD操作函数
axlFormSetField
axlFormGetField
axlFormSetFieldEditable
axlFormSetFieldVisible
axlColorDoc
axlFormColorize
LIST定义
FIELD label
FLOC x y
LIST "" w h
list_options
ENDFIELD
LIST选项:
[OPTIONS sort|alphanumsort|prettyprint|multiselect]
sort - convertion alphabetical sort alphanumsort - sort so NET10 appears after NET2
prettyprint - make more readable, convert case.All dispatch entries will be upper case
multiselect - multi-select list box. User can select more then one item (follows Microsoft selection model).
通过x,y,w和h四个整数表示LIST外形,x和y用于控制位置,w和h用于控制尺寸
x
y
w ; x&h单位按照字符高度的一半
h ; y&w单位按照字符宽度的一半
BUTTON定义
FIELD label
FLOC x y
[FSIZE w h] (8)
MENUBUTTON "display" w h
button_options
ENDFIELD
BUTTON选项:
[MULTILINE]
- wraps button text to multiple lines if text string is too long for a single line.
CHECKLIST
CHECKLIST有两种类型:
- Checkbox
- Radiobox
GRID定义
GRID fieldName
FLOC x y
FSIZE w h (8)
[OPTIONS INFO | HLINES | VLINES | USERSIZE ]
[POP "<popupName>"]
[GHEAD TOP|SIDE]
[HEADSIZE h|w]
[OPTION 3D|NUMBER]
[POP "<popupName>"]
[ENDGREADH]
ENDGRID
版权声明:本文为zdx19880830原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。