1> ADD按钮的click事件
long tot,tot1,tot2
tot1 = dw_1.rowcount()
tot2=dw_1.insertrow(0)
tot=tot1+1
dw_1.setitem(tot2,1,tot)
dw_1.SetFocus()
dw_1.ScrollToRow(tot2)
dw_1.SetColumn(1)
st_rows.text=string(dw_1.rowcount()) //显示数据行数
----------------------------------------------------------------------------
2> DELETE按钮的click事件
if dw_1.rowcount()=0 then
return
end if
int p_message
p_message= MessageBox("WARNING","do you delete?",Exclamation!, OKCancel!, 2)
//删除数据后要做一次刷新
choose case p_message
case 1
dw_1.deleterow(dw_1.getrow())
cb_save.PostEvent(Clicked!)
end choose
-------------------------------------------------------------------------------
3> SAVE按钮的click事件
if dw_1.rowcount()=0 then
return
end if
if dw_1.update(true,false)=1 then
dw_1.resetUpdate()
commit;
messagebox("OK","The data is saved successfully!")
else
rollback;
end if
dw_1.SetRedraw(FALSE)
cb_search.PostEvent(Clicked!) //SAVE数据后从新SERACH数据
dw_1.SetRedraw(TRUE)
-------------------------------------------------------------------------------
4> COPY按钮的click事件
if dw_1.rowcount()=0 then
return
end if
int selectrow,objectrow
selectrow=0
selectrow=dw_1.getrow()
//if selectrow=1 then return
objectrow=selectrow+1
dw_1.RowsCopy(selectrow,selectrow, Primary!,dw_1,objectrow,primary!)
dw_1.ScrollToRow(objectrow) //滾動行copy本行到下一行
dw_1.object.detail[objectrow]=""
st_rows.text=string(dw_1.rowcount())
-------------------------------------------------------------------------------
5> EXCEL按钮的click事件
if dw_1.rowcount()=0 then
return
end if
dw_1.saveas('',excel!,true)
-------------------------------------------------------------------------------
6> PRINT按钮的click事件
if dw_1.rowcount()=0 then
return
end if
int p_message
p_message= MessageBox("WARNING","do you print?,~r~n YES,~r~n NO! ", &
Exclamation!, OKCancel!, 2)
choose case p_message
case 1
dw_1.print()
end choose
-------------------------------------------------------------------------------
7> SEARCH按钮的click事件
要在数据窗口里ARGUMENT设置三个参数
string s,c,w
s=trim(ddlb_s.text)
c=trim(ddlb_c.text)
w=trim(sle_w.text)
w=lower(w)
if s="" then
s="%"
else
s=s+"%"
end if
if c="" then
c="%"
else
c=c+"%"
end if
if w="" then
w="%"
else
w="%"+w+"%"
end if
dw_1.retrieve(s,c,w)
st_rows.text=string(dw_1.rowcount())
-------------------------------------------------------------------------------
8> RESET按钮的click事件
有数据的全部置空
dw_1.reset()
st_rows.text="0"
sle_w.text=""
ddlb_c.text=""
ddlb_s.text=""
-------------------------------------------------------------------------------
9> 鼠标右键功能的事件
首先:要做一个菜单 m_popup,子菜单为add,detele,copy
add的click事件代码:
long newrow
newrow=w_wording.dw_1.insertrow(0)
w_wording.dw_1.scrolltorow(newrow)
detele的click事件代码:
w_wording.dw_1.deleterow(0)
copy的click事件代码:
if w_wording.dw_1.rowcount()=0 then
return
end if
int selectrow,objectrow
selectrow=0
selectrow=w_wording.dw_1.getrow()
if selectrow=1 then return
objectrow=selectrow+1
第二步:在DW_1数据窗口的rbuttondown的事件下写如下代码
m_popup=CREATE m_popup
m_popup.PopMenu(parent.PointerX()+1, parent.PointerY()+1)
在DW_1数据窗口的click的事件下写如下代码
this.selectrow(0,false)
this.selectrow(row,true)
-------------------------------------------------------------------------------
日期函數
定義 return type 為string
Argument type 為 date
function name month_day
Argument name qs_date
string english_mouth[12]={"January","February","March","April","May","June","July","August","September","October","November","December"}
string return_mouth
return_mouth=english_mouth[Month(qs_date)]+' '+string(day(qs_date))
return return_mouth