先定义实例变量 long il_selectrow
在datawindow的rbuttondown事件中写如下代码
long ll_first_row ,ll_row,ll_detail_height
long ll_last_row,ll_pos_height
string str_band
str_band=GetBandAtPointer() //得到当前鼠标所指对象所在的带区
str_band=left(str_band,(pos(str_band,'~t') - 1))//得到"header"、"detail"等
if pos(str_band,"detail")>0 then
st_5.visible=true
this.selectrow(0,false)
this.selectrow(row,true)
st_5.x= this.x + pointerX() + 100
if this.height - pointerY() > st_5.Height then
st_5.y= this.y + pointerY() + 50
else
st_5.y= this.y + pointerY() - st_5.Height - 50
end if
il_selectrow=row
else
st_5.visible=false
this.selectrow(0,false)
il_selectrow=0
end if
用鼠标滚动时如果选择行不可见,在 scrollvertical写如下代码,可以隐藏文本框
long ll_first_row_onpage
long ll_last_row_onpage
ll_first_row_onpage = long( this.Object.DataWindow.FirstRowOnPage)
ll_last_row_onpage= long( this.Object.DataWindow.LastRowOnPage)
st_1.text="il_selectrow=" +string(il_selectrow) + " ll_first_row_onpage=" + string(ll_first_row_onpage) + " ll_last_row_onpage=" +string(ll_last_row_onpage)
if not(il_selectrow>=ll_first_row_onpage and il_selectrow<=ll_last_row_onpage) then
this.selectrow(0,false)
st_5.visible=false
end if