!******************************************************** !* Creating Object Window (COW) system. !* MACRO MODULE m_edit(); !* This macro module creates an rektangel in the active !* module and generate a cre_edit part call in a MBS-file. !* It demonstrates the use of parameters, constants and !* variables as well as macros and 'add_mbs' calls. !* !* The module was originally created interactively but !* comments and small changes have been added later !* through the MBS-editor. !* !* This program is done for both english and swedish users with !* Linux or WIN95 VARKON system. !* This version of (COW) is a demo with no connection of !* objects to the created windows. !* !* (C) AB Daterra 1997 !* Thomas Hellner !* !******************************************************** INT main_id,hor_streck,ver_streck,rubr1,rubr2,rubr3, bidx,bid1,bid2,bid3,bid4,bid5,bid6,bid7,bid8,bid9,bid10, edit1,edit2,edit3,edit4,edit5,edit6,edit7,edit8,edit9,edit10, icon1,icon2,icon3,icon4,icon2_status; CONSTANT VECTOR main_pos = vec(125,10); CONSTANT FLOAT main_dx= 260,main_dy= 350; CONSTANT STRING BIG_FONT = "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1"; CONSTANT STRING MED_FONT = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1"; ref id; string errm*32; STRING editn*32, ! bidd number pos*132, ! windowcorner uper left b*32, ! windowwidth in pixels h*32, ! windowheight in pixels r*32, ! framethicknes in pixels s*132, ! text ntkn*32; ! text color int status; string pm1*132, pm2*132, par*132, doc*132, lang*132, path*132; BEGINMODULE par:="vec(0,0)"; !* !****Declare and get some environment parameters. !* lang:=get_environment("VARKON_INI"); doc:=get_environment("VARKON_PRD"); path:=get_environment("VARKON_PRD"); !* !****Create the main window. !* main_id:=cre_win(main_pos,main_dx,main_dy,"**** COW ****"); !* !****Create the company loggo in the main window. !* if finds(act_ostype(),"WIN")=0 then icon1:=cre_icon(main_id,vec(10,3),3, path+"/Cow/ico/loggo.xbm",7,1); icon1:=cre_icon(main_id,vec(90, 3),3, path+"/Cow/ico/edit.xbm",7,1); else icon1:=cre_icon(main_id,vec(10, 3),3, path+"\Cow\ico\loggo.bmp",7,1); icon1:=cre_icon(main_id,vec(90,3),3, path+"\Cow\ico\edit.bmp",7,1); endif; !* !****Create the company name in the main window. !* bid5:=cre_button(main_id,vec(60,77),200,15,0, " ** AB DATERRA ** ",""); !* !****Create edit areas for input values in the main window. !* edit1:=cre_edit(main_id,vec(85,100),160,20,2," ",45); edit2:=cre_edit(main_id,vec(85,130),40,20,2,"1",45); edit3:=cre_edit(main_id,vec(85,160),40,20,2,"90",45); edit4:=cre_edit(main_id,vec(85,190),40,20,2,"20",45); edit5:=cre_edit(main_id,vec(85,220),40,20,2,"2",45); edit6:=cre_edit(main_id,vec(85,250),160,20,2,"TEXT",45); edit10:=cre_edit(main_id,vec(85,280),40,20,2,"45",45); !* !****Create text for the edit areas off input values in the main window. !* if finds(lang,"english")=0 then bid6:=cre_button(main_id,vec(10,100),70,20,2,"Position"," P1 ",""); bid4:=cre_button(main_id,vec(10,130),70,20,0,"Id hid"," ",""); bid4:=cre_button(main_id,vec(10,160),70,20,0,"Bredd b"," ",""); bid4:=cre_button(main_id,vec(10,190),70,20,0,"Höjd h"," ",""); bid4:=cre_button(main_id,vec(10,220),70,20,0,"Ram r"," ",""); bid4:=cre_button(main_id,vec(10,250),70,20,0,"Text s"," ",""); bid4:=cre_button(main_id,vec(10,280),70,20,0,"Ant.te ntkn"," ",""); !* !****Create the Ok/Reject/Help buttons in the main window. !* bid1:=cre_button(main_id,vec(5,320),55,22,3,"Ok","Ok",""); bid2:=cre_button(main_id,vec(70,320),55,22,3,"Avbryt","Avbryt",""); bid3:=cre_button(main_id,vec(135,320),55,22,3,"Hjälp","Hjälp",""); else bid6:=cre_button(main_id,vec(10,100),70,20,2,"Position"," P1 ",""); bid4:=cre_button(main_id,vec(10,130),70,20,0,"Id hid"," ",""); bid4:=cre_button(main_id,vec(10,160),70,20,0,"Width b"," ",""); bid4:=cre_button(main_id,vec(10,190),70,20,0,"Heigth h"," ",""); bid4:=cre_button(main_id,vec(10,220),70,20,0,"Frame r"," ",""); bid4:=cre_button(main_id,vec(10,250),70,20,0,"Text s"," ",""); bid4:=cre_button(main_id,vec(10,280),70,20,0," ntkn"," ",""); !* !****Create the Ok/Reject/Help buttons in the main window. !* bid1:=cre_button(main_id,vec(5,320),55,22,3,"Ok","Ok",""); bid2:=cre_button(main_id,vec(70,320),55,22,3,"Reject","Reject",""); bid3:=cre_button(main_id,vec(135,320),55,22,3,"Help","Help",""); endif; !* !****Show the main window on screen. !* show_win(main_id); !* !****Wait for input. !* loop: bidx:=wait_win(main_id); if bidx = bid1 then !* !****The Ok button is chosen. !* pos:=get_edit(main_id,edit1); editn:=get_edit(main_id,edit2); b:=get_edit(main_id,edit3); h:=get_edit(main_id,edit4); r:=get_edit(main_id,edit5); s:=get_edit(main_id,edit6); ntkn:=get_edit(main_id,edit10); !* !****Check indata. !* part(#10,m_error(lang,pos,b,h,r,"1","1",errm)); if finds(errm,"0")=0 then goto loop;endif; id:=add_mbs("part","men_edit", editn,pos,b,h,r,chr(34)+s+chr(34),ntkn); del_win(main_id); exit(); elif bidx = bid2 then !* !****The Reject button is chosen. !* del_win(main_id); exit(); elif bidx = bid3 then !* !****The Help button is chosen. !* if finds(act_ostype(),"WIN")=0 then part(#20,m_help(doc+"/Cow/doc/cre_edit.doc")); else part(#30,m_help(doc+"\Cow\doc\cre_edit.doc")); endif; goto loop; elif bidx = bid6 then !* !****Some other is chosen. !* part(#40,ma_posw(par,"Edit","Select position",status)); if status <> 0 then del_win(main_id,edit1); edit1:=cre_edit(main_id,vec(85,100),160,20,2,par,132); pos:=get_edit(main_id,edit1); show_win(main_id); endif; goto loop; else goto loop; endif; ENDMODULE