如何在datawindow中将里面的内容分为两半,然后可以分别用滚动条拉动
急用啊,谢谢
如何在datawindow中将里面的内容分为两半,然后可以分别用滚动条拉动
急用啊,谢谢
以前做過,是一個對象,現在沒用PB了,忘記了!
我把對象給導出你看吧!
$PBExportHeader$uo_datawindow.sru
$PBExportComments$数据窗类,提供单选、多选等基本功能
forward
global type uo_datawindow from datawindow
end type
end forward
global type uo_datawindow from datawindow
integer width = 1330
integer height = 928
integer taborder = 10
boolean hscrollbar = true
boolean vscrollbar = true
boolean hsplitscroll = true
boolean livescroll = true
borderstyle borderstyle = stylelowered!
event uo_enterkeydown pbm_dwnprocessenter
event uo_keydown pbm_dwnkey
end type
global uo_datawindow uo_datawindow
type variables
Public:
boolean MultiSelect = False
long LastRow
integer ii_ShowStatus = 50 // Mostrar onde vai de 50 em 50 (por defeito)
Private:
string is_OrderCol, is_SortType = "D"
boolean ib_Arrows = False, ib_MouseDown = False, ib_Selected = False
end variables
forward prototypes
public subroutine dw_sort (long row, dwobject dwo)
public subroutine dw_select_m (datawindow dw_w, integer dw_row)
public subroutine dw_select_s (datawindow dw_w, integer dw_row)
public subroutine dw_resize (datawindow dw_child, window w_parent, integer dw_child_x, integer dw_child_y)
public subroutine dw_resize_b (datawindow dw_child, window w_parent, integer dw_child_x, integer dw_child_y)
public subroutine dw_f_enterkeydown (integer li_colcount)
public subroutine dw_keydown ()
end prototypes
event uo_enterkeydown;///////////////////////
//用ENTER键代替TAB键
////////////////////////
if this.AcceptText() < 0 then
Return 1
end if
if this.GetColumn() = Long(this.object.datawindow.column.count) then
if this.GetRow() = this.RowCount() then
this.Insertrow(0)
this.ScrollToRow(this.GetRow() + 1)
this.SetColumn(1)
Return 1
end if
end if
Send(Handle(this),256,9,Long(0,0))
return 1
end event
event uo_keydown;dw_keydown()
end event
public subroutine dw_sort (long row, dwobject dwo);//******************************************************************************
//
// 通过点击数据窗口的标题条对数据窗口进行排序
// 应包含两个图片文件(orderdw.bmp orderup.bmp),在pic目录下。
//
//*******************************************************************************
string ls_AddPict, ls_CurObj, ls_Picture, ls_CurCol
integer li_PictPos
ls_CurObj = String(dwo.Name)
If Row = 0 AND This.Describe(ls_CurObj + ".Text") <> "!" AND This.Describe(ls_CurObj + ".Band") = "header" Then // Valid header object?
ls_CurCol = Left(ls_CurObj,Len(ls_CurObj) - 2)
If is_OrderCol <> ls_CurCol Then // Different Column
This.Modify("DESTROY p_" + is_OrderCol)
is_OrderCol = Left(ls_CurObj,Len(ls_CurObj) - 2)
ls_Picture = "image\ORDERUP.BMP"
is_SortType = "A" // Ascending sort
li_PictPos = Integer(This.Describe(ls_CurObj + ".X"))+ (Integer(This.Describe(ls_CurObj + ".Width")) - 70)
ls_AddPict ='create bitmap(band=foreground filename="' + ls_Picture + '" ' + &
' x="' + String(li_PictPos) + "~tInteger(describe('" + is_OrderCol + &
".X')) + (Integer(describe('" + is_OrderCol + ".Width'))" + ' - 70)" y="24" ' + &
' height="33" width="51" border="0" name=p_' + is_OrderCol + ' visible="1")'
This.Modify(ls_AddPict)
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
Else
If is_SortType = "A" Then
ls_Picture = "image\ORDERDW.BMP"
is_SortType = "D"
Else
ls_Picture = "image\ORDERUP.BMP"
is_SortType = "A"
End If
This.Modify('p_' + is_OrderCol + '.filename = "' + ls_Picture + '"')
This.SetSort(is_OrderCol + " " + is_SortType)
This.Sort()
End If
End If
end subroutine
public subroutine dw_select_m (datawindow dw_w, integer dw_row);long ll_last_row,ll_i
if isnull(dw_row) then
dw_w.selectrow(0,false)
return
end if
if dw_row = 0 then
dw_w.selectrow(0,false)
return
end if
//任意的多行选择
if keydown(KeyControl!) then
if dw_w.isselected(dw_row) then
dw_w.selectrow(dw_row,false)
else
dw_w.selectrow(dw_row,true)
end if
return
end if
//连续的多行选择
if keydown(keyshift!) then
ll_last_row = dw_w.getselectedrow(0)
if ll_last_row > 0 then
dw_w.selectrow(0,false)
if dw_row > ll_last_row then
for ll_i = ll_last_row to dw_row
dw_w.selectrow(ll_i,true)
next
else
for ll_i = dw_row to ll_last_row
dw_w.selectrow(ll_i,true)
next
end if
else
dw_w.selectrow(0,false)
dw_w.selectrow(dw_row,true)
end if
return
end if
//单行选择
dw_w.selectrow(0,false)
dw_w.selectrow(dw_row,true)
end subroutine
public subroutine dw_select_s (datawindow dw_w, integer dw_row);long ll_last_row,ll_i,rowcount
if isnull(dw_row) then
dw_w.selectrow(0,false)
return
end if
if dw_row = 0 then
dw_w.selectrow(0,false)
return
end if
//
//单行选择
this.selectrow(0,false)
this.selectrow(dw_row,true)
end subroutine
public subroutine dw_resize (datawindow dw_child, window w_parent, integer dw_child_x, integer dw_child_y);integer li_width,li_height
li_width = w_parent.width
li_height = w_parent.height
dw_child.x = dw_child_x
dw_child.y = dw_child_y
dw_child.width = li_width - dw_child_x -40
dw_child.height = li_height - dw_child_y - 110
end subroutine
public subroutine dw_resize_b (datawindow dw_child, window w_parent, integer dw_child_x, integer dw_child_y);integer li_width,li_height
li_width = w_parent.width
li_height = w_parent.height
dw_child.x = dw_child_x
dw_child.y = 8
dw_child.width = li_width - dw_child_x -40
dw_child.height = li_height - dw_child_y - 110
end subroutine
public subroutine dw_f_enterkeydown (integer li_colcount);//*******************************************************
//
//用回车键代替Tab键的功能函数 (参数:li_colcount 列的数量)
//
//******************************************************
integer li_curcol,li_cnt,li_row
li_curcol = getcolumn()
if li_curcol < li_colcount then
li_curcol = li_curcol + 1
setcolumn(li_curcol)
else
if rowcount() <= getrow() then
li_cnt = insertrow(0)
scrolltorow(li_cnt)
setcolumn(1)
else
li_cnt = getrow() + 1
setrow(li_cnt)
setcolumn(1)
end if
end if
//return 1
end subroutine
public subroutine dw_keydown ();long ll_currentrow,ll_rowcount,ll_currentcolumn,ll_columncount
string ls_dataobject
ll_currentrow = this.getrow()
ll_rowcount = this.rowcount()
//控制键盘上、下的箭头动作
IF KeyDown(KeyDownArrow!) then
if ll_currentrow >= ll_rowcount then
this.selectrow(0,false)
this.selectrow(ll_currentrow,true)
else
this.selectrow(0,false)
this.selectrow(ll_currentrow + 1,true)
end if
end if
//
if KeyDown(KeyUpArrow!) then
if ll_currentrow <= 1 then
this.selectrow(0,false)
this.selectrow(1,true)
else
this.selectrow(0,false)
this.selectrow(ll_currentrow - 1,true)
end if
end if
//用左右箭头模仿TAB键
//ls_dataobject = this.dataobject
//ll_columncount = this.object.ls_dataobject.column.count
//ls_colcount = dw_1.Object.DataWindow.Column.Count
end subroutine
event losefocus;accepttext()
end event
event itemerror;return 1
end event
event error;//
action = exceptionignore!
end event
on uo_datawindow.create
end on
on uo_datawindow.destroy
end on
event dberror;//return F_Dw_DbError (sqldbcode , THIS , row)
end event
昏昏,这么复杂啊,有没有更简单点的?头都大了!~~~~~
不可以在哪里设置吗?