标题:如何在datawindow中将里面的内容分为两半
只看楼主
yzxsl
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-4-8
 问题点数:0 回复次数:2 
如何在datawindow中将里面的内容分为两半

如何在datawindow中将里面的内容分为两半,然后可以分别用滚动条拉动
急用啊,谢谢

搜索更多相关主题的帖子: 中将里面 datawindow 两半 滚动 
2006-04-11 10:26
ヤ順祺冄繎ヤ
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:3032
专家分:0
注 册:2005-11-9
得分:0 

以前做過,是一個對象,現在沒用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

2006-04-11 10:47
yzxsl
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-4-8
得分:0 
..........

昏昏,这么复杂啊,有没有更简单点的?头都大了!~~~~~
不可以在哪里设置吗?

2006-04-11 10:58



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-56700-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.926609 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved