|
本帖最后由 xieeyawen 于 2025-4-27 20:01 编辑
第一种方法是构建form函数
- defun( CreateOblThForm ()
- MainFormFile=axlTempFile()
- p = outfile(MainFormFile "w")
- f_FormBegin(p 35,20,"Create Oblong Thermal - RichardL." "TOOLWINDOW")
- f_Bitmap(p "cot" "cot" 0 0 14 14)
- f_Text(p "Outer diameter(A):",15,0) f_EditFloat(p "A",29,0,5,5,4)
- f_Text(p "Inner diameter(B):",15,3) f_EditFloat(p "B",29,3,5,5,4)
- f_Text(p "Oblong length(D):", 15,6) f_EditFloat(p "D",29,6,5,5,4)
- f_Text(p "Circle spoke(C):", 15,9) f_EditFloat(p "C",29,9,5,5,4)
- f_Text(p "Oblong spoke(E):", 15,12) f_EditFloat(p "E",29,12,5,5,4)
- f_Group(p "Direction",2,14,32,4)
- f_CheckList(p "H", 4,16,"Horizontal","di")
- f_CheckList(p "V",18,16,"Vertical","di")
- f_Button(p "OK",2,19,10,3)
- f_Button(p "Cancel",20,19,10,3)
- f_FormEnd(p)
- close(p)
- MainFormFile
- );func
- ;以下为构造的标准化form命令函数
- ;f_FormBegin(p w h title form_opt) TOOLWINDOW / AUTOGREYTEXT / FIXED_FONT / UNIXHGT
- defun( f_FormBegin (p w h @optional (form_title "by RichardL.") (form_opt "AUTOGREYTEXT"))
- sprintf(dest,"FILE_TYPE=FORM_DEFN VERSION=2\nFORM %s\nFIXED\nPORT %d %d\nHEADER "%s"\nTILE\n\n",form_opt,w,h,form_title)
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_FormEnd(p flexmode) StandButtons / EdgeGravity / EdgeGravityOne
- defun( f_FormEnd (p @optional flexmode)
- if(flexmode sprintf(dest,"FLEXMODE %s\nENDTILE\nENDFORM\n",flexmode)
- sprintf(dest,"ENDTILE\nENDFORM\n")
- )
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_CheckList(field x y name group)
- defun( f_CheckList (p field x y name @optional (group nil))
- if(group==nil
- sprintf(dest,"FIELD %s\nFLOC %d %d\nCHECKLIST "%s" \nENDFIELD\n\n",field,x,y,name)
- sprintf(dest,"FIELD %s\nFLOC %d %d\nCHECKLIST "%s" "%s"\nENDFIELD\n\n",field,x,y,name,group)
- )
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_Group(field x y w h)
- defun( f_Group (p field x y w h)
- sprintf(dest,"GROUP "%s"\nFLOC %d %d\nFSIZE %d %d\nENDGROUP\n\n",field,x,y,w,h)
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_Text(field x y)
- defun( f_Text (p text x y)
- sprintf(dest,"TEXT "%s"\nFLOC %d %d\nENDTEXT\n\n",text,x,y)
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_EditFloat(field x y iw dw dec) (iw-input width) (dw-data width)
- defun( f_EditFloat (p field x y iw dw dec)
- sprintf(dest,"FIELD %s\nFLOC %d %d\nREALFILLIN %d %d\nDECIMAL %d\nENDFIELD\n\n",field,x,y,iw,dw,dec)
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_Button(x y w h)
- defun( f_Button (p name x y w h) ;close done/ok cancel help print
- sprintf(dest,"FIELD %s\nFLOC %d %d\nMENUBUTTON "%s" %d %d\nENDFIELD\n\n",name,x,y,name,w,h)
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_Bitmap(name x y w h @optional opt)
- defun( f_Bitmap (p field name x y w h @optional (opt nil)) ;[RIGHT | CENTER | BORDER | BOLD | UNDERLINE]
- if(opt==nil
- sprintf(dest,"FIELD %s\nthUMBNAIL %s\nFLOC %d %d\nFSIZE %d %d\nENDFIELD\n\n",field,name,x,y,w,h)
- sprintf(dest,"FIELD %s\nTHUMBNAIL %s\nOPTIONS %s\nFLOC %d %d\nFSIZE %d %d\nENDFIELD\n\n",field,name,opt,x,y,w,h)
- )
- if(p fprintf(p,"%s",dest))
- dest
- )
- ;f_TreeView(field x y w h)
- defun( f_TreeView (p field x y w h)
- sprintf(dest,"FIELD %s\nFLOC %d %d\nTREEVIEW %d %d\nENDFIELD\n\n",field,x,y,w,h)
- if(p fprintf(p,"%s",dest))
- dest
- )
复制代码
|
|