二、主程序設(shè)計
1、主程序(用頂層表單,不能調(diào)用計算器、報表設(shè)計器)
public drive
drive=alltrim(sys(16))
dr=substr(drive,1,2)
with _screen
endwith
close all
application.visible=.f.
deactivate window"project manager"
set default to&dr\njjl,&dr\njjl\scx,&dr\njjl\dbf,&dr\njjl\\vcx,&dr\njjl\bmp,
&dr\njjl\frm,&dr\njjl\prg
do &dr\njjl\prg\setting
do form &dr\njjl\scx\rh_dl
on
read events
do &dr\njjl\prg\reset
(1)、登錄表單(頂層表單)密碼文本框LostFocus事件代碼
public user
if alltrim(thisform.text1.value)==alltrim(b_rh.口令)
user=b_rh.用戶級別
thisform.release
do form e:\njjl\scx\njjl_main
else
ctitle="農(nóng)機監(jiān)理信息管理系統(tǒng)"
ctext="密碼錯誤,重新輸入嗎?"
yn=messagebox(ctext,4+32,ctitle)
do case
case yn=6
thisform.text1.value=""
thisform.text1.setfocus
case yn=7
ctitle="農(nóng)機監(jiān)理信息管理系統(tǒng)"
ctext="不要入侵我的系統(tǒng)!"
messagebox(ctext,48,ctitle)
thisform.release
quit
endcase
endif
2、*主程序(不用頂層表單,建立一窗口,可調(diào)用計算器、報表設(shè)計器)
close all
public user
user=2
deactivate window"project manager"
set default to d:\fcgl,d:\fcgl\scx,d:\fcgl\dbf,d:\fcgl\vcx,d:\fcgl\bmp,d:\fcgl\frm,d:\fcgl\prg
do d:\fcgl\prg\setting
do form d:\fcgl\scx\dl_fc
with _screen
define window mywin from 0,0 to 150,150 ;
fill file d:\fcgl\bmp\小屋.jpg
activate window mywin bottom
do d:\fcgl\mpr\cd_fc.mpr
on
read events
do d:\fcgl\prg\reset
(1)、登錄表單(頂層表單)密碼文本框LostFocus事件代碼
if thisform.text1.value=b_rh.口令
user=b_rh.用戶級別
thisform.release
*application.visible=.t.
_screen.windowstate=2
_screen.visible=.t.
*_screen.enabled=.t.
else
ctitle="房地產(chǎn)信息管理系統(tǒng)"
ctext="密碼錯誤,重新輸入嗎?"
yn=messagebox(ctext,4+32,ctitle)
do case
case yn=6
thisform.text1.value=""
thisform.text1.setfocus
case yn=7
ctitle="房地產(chǎn)信息管理系統(tǒng)"
ctext="不要入侵我的系統(tǒng)!"
messagebox(ctext,32,ctitle)
thisform.release
quit
endcase
endif
三、數(shù)據(jù)錄入:(有主索引字段,防止重復(fù)輸入)
1、表單init事件代碼
use d:\txl\dbf\b_txl
go bottom
THISFORM.TEXT1.VALUE=姓名
THISFORM.TEXT2.VALUE=手機
thisform.text1.enabled=.f.
thisform.text2.enabled=.f.
thisform.command1.caption='添加'
2、text1(主索引字段) lostfocus事件代碼(姓名為主索引)
sele b_txl
locate for alltrim(姓名)==alltrim(thisform.text1.value)?。秒p等號
if found()
messagebox('此記錄已存在!',48,'信息提示')
thisform.text1.value=姓名
thisform.text2.value=手機
thisform.text1.enabled=.f.
thisform.text2.enabled=.f.
thisform.command1.caption='添加'
endif
3、‘確定’按鈕單擊事件代碼
sele b_txl
if this.caption='確定'
appe blank
replace next 1 姓名with THISFORM.TEXT1.VALUE
replace next 1 手機with THISFORM.TEXT2.VALUE
this.caption='添加'
*THISFORM.TEXT1.VALUE=''
*THISFORM.TEXT2.VALUE=''
thisform.text1.enabled=.f.
thisform.text2.enabled=.f.
THISFORM.TEXT1.setfocus
else
thisform.text1.enabled=.t.
thisform.text2.enabled=.t.
THISFORM.TEXT1.VALUE=''
THISFORM.TEXT2.VALUE=''
THISFORM.TEXT1.setfocus
this.caption='確定'
endif
|
|