|
axlCmdRegister("cmm" `convert_mil_mm ?cmdType "general")
procedure(convert_mil_mm()
create_form()
mform=axlFormCreate( (gensym) form_file nil 'form_action t )
axlFormDisplay(mform)
)
procedure(form_action(temp_form)
case(temp_form->curField
("txt_mil"
mil=atof(temp_form->curValue)
axlFormSetField(temp_form,"txt_mm",mil/39.37)
)
("txt_mm"
mm=atof(temp_form->curValue)
axlFormSetField(temp_form,"txt_mil",mm*39.37)
)
)
)
procedure(create_form()
form_file = "temp.form"
temp_form = outfile(form_file "w")
fprintf(temp_form "FILE_TYPE=FORM_DEFN VERSION=2\n")
fprintf(temp_form "FORM\n")
fprintf(temp_form "FIXED\n")
fprintf(temp_form "PORT 38 5\n")
fprintf(temp_form "HEADER \"Convert mil<->mm\"\n")
fprintf(temp_form "TILE\n")
fprintf(temp_form "TEXT \"MIL\"\n")
fprintf(temp_form "TLOC 2 1\n")
fprintf(temp_form "ENDTEXT\n")
fprintf(temp_form "FIELD txt_mil\n")
fprintf(temp_form "FLOC 5 1\n")
fprintf(temp_form "STRFILLIN 10 20\n")
fprintf(temp_form "ENDFIELD\n")
fprintf(temp_form "TEXT \"<-->\"\n")
fprintf(temp_form "TLOC 17 1\n")
fprintf(temp_form "ENDTEXT\n")
fprintf(temp_form "FIELD txt_mm\n")
fprintf(temp_form "FLOC 20 1\n")
fprintf(temp_form "STRFILLIN 10 20\n")
fprintf(temp_form "ENDFIELD\n")
fprintf(temp_form "TEXT \"MM\"\n")
fprintf(temp_form "TLOC 32 1\n")
fprintf(temp_form "ENDTEXT\n")
fprintf(temp_form "ENDTILE\n")
fprintf(temp_form "ENDFORM\n")
close(temp_form)
)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
评分
-
查看全部评分
|