我又迷糊了!
程序代码:
&&main.prg SET TALK OFF SET ECHO OFF SET DATE TO ansi SET ESCAPE ON SET SAFETY OFF SET EXACT OFF SET DELETED ON SET CENTURY ON CLOSE ALL CLEAR ALL &&_screen.Visible= .F. &&在config.fpw中用SCREEN=OFF代替了 PUBLIC currUser &&,userPerm 登录用户权限 PUBLIC myDrv,myDir,myProgPath &&当前程序所在盘和所在路径 myDrv=SYS(5) myDir=SYS(2003) myProgPath=myDrv+myDir SET DEFAULT TO &myProgPath DO 登录验证.prg &&READ events DEFINE CLASS showWindowForm as Form showWindow=2 PROCEDURE destroy CLEAR EVENTS ENDPROC ENDDEFINE DEFINE CLASS exitBtn as CommandButton PROCEDURE click RELEASE thisform ENDPROC ENDDEFINE
————————————————————————
程序代码:
&&登录验证.prg USE 授权用户 loginForm=CREATEOBJECT("logForm") WITH loginForm .caption="欢迎登录材料管理系统" .autoCenter=.t. .width=300 .height=200 .titleBar=0 &&.showWindow=2 写在这里不行 .picture="登录背景.bmp" .icon="logo.ico" .controlBox=.f. .show ENDWITH READ EVENTS RETURN DEFINE CLASS logForm as showWindowForm ADD OBJECT cmdExit as exitBtn WITH top=168,left=228,height=25,width=60,caption="退 出" ADD OBJECT cmdLogin as loginBtn ADD OBJECT userNameCombo as logCbx ADD OBJECT passwordCheck as logPass ADD OBJECT lbl1 as Label WITH caption="水电工程处",; alignment=2,; backStyle=0,; fontSize=16,; foreColor=RGB(0,0,0),; height=24,; left=48,; top=12,; width=204 ADD OBJECT lbl2 as Label WITH caption="材料管理系统",; alignment=2,; backStyle=0,; fontSize=18,; foreColor=RGB(0,0,0),; height=24,; left=63,; top=48,; width=174 ADD OBJECT lbl3 as Label WITH caption="用户名:",; backStyle=0,; fontSize=12,; foreColor=RGB(0,0,0),; height=24,; left=24,; top=84,; width=60 ADD OBJECT lbl4 as Label WITH caption="密 码:",; backStyle=0,; fontSize=12,; foreColor=RGB(0,0,0),; height=24,; left=24,; top=132,; width=60 ENDDEFINE DEFINE CLASS loginBtn as CommandButton top=168 left=144 height=25 width=60 caption="登 录" PROCEDURE init PUBLIC testLoginCount testLoginCount=3 ENDPROC PROCEDURE click IF ALLTRIM(thisform.userNameCombo.Value)==ALLTRIM(授权用户.用户名) ; AND ALLTRIM(thisform.passwordCheck.value)==ALLTRIM(授权用户.密码) currUser=ALLTRIM(授权用户.用户名) thisform.Release DO 主程序.prg ELSE testLoginCount=testLoginCount-1 IF testLoginCount=0 MESSAGEBOX("尝试登录过于频繁,程序将退出!如有问题,请联系程序管理员!",64,"非法登录警告!") thisform.Release CLEAR EVENTS ELSE msgText="用户名或密码错误,你还有"+ALLTRIM(STR(testLoginCount))+"次机会!" =MESSAGEBOX(msgText,64,"重试登录") thisform.passwordCheck.Value="" thisform.passwordCheck.SetFocus() ENDIF ENDIF ENDDEFINE DEFINE CLASS logCbx as ComboBox left=96 top=84 width=156 height=24 fontSize=12 rowSource="授权用户.用户名" rowSourceType=6 ENDDEFINE DEFINE CLASS logPass as TextBox passwordChar="." left=96 height=24 top=132 width=156 fontSize=24 ENDDEFINE
————————————————————————————————————
程序代码:
&&主程序.prg mainForm=CREATEOBJECT("mForm") WITH mainForm .caption="水电工程处材料管理系统" .autoCenter=.t. .borderStyle=2 .icon="logo.ico" .picture="主背景.bmp" .height=550 .width=770 .maxButton=.f. .show ENDWITH READ EVENTS RETURN DEFINE CLASS mForm as showWindowForm ADD OBJECT cmdExit as exitBtn WITH caption="退出系统",top=504,left=108,height=25,width=60 ENDDEFINE &&加入下面的代码,这个表单可以独立运行。。。。。。。。。 *!* DEFINE CLASS showWindowForm as Form *!* showWindow=2 *!* *!* PROCEDURE destroy *!* CLEAR EVENTS *!* ENDPROC *!* *!* ENDDEFINE *!* DEFINE CLASS exitBtn as CommandButton *!* *!* PROCEDURE click *!* RELEASE thisform *!* ENDPROC *!* ENDDEFINE
输入密码 登录后 主程序窗口不见了 什么情况?
是不是表单类之间的关系 我没弄明白啊???????