数据窗口的一个控件是否存在如何判断?如t_1.

xxxuan 2001-09-07 05:31:03
数据窗口的一个控件是否存在如何判断?如t_1.
...全文
134 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
pbdesigner 2001-09-08
  • 打赏
  • 举报
回复
用得着这么麻烦吗?
string ls_objname //数据窗口内任何对象
boolean lb_exist //是否存在
if dw_1.describe(ls_objname+".Attributes") = '!' then
lb_exist = false //不存在
else
lb_exist = true //存在
end if
ping_ping 2001-09-08
  • 打赏
  • 举报
回复
:)1genut(公子黑臀)方法是对的,取出所有对象,再用字符串函数处理,然后判断类型
fallstone 2001-09-08
  • 打赏
  • 举报
回复
为什么要判断?
xxxuan 2001-09-08
  • 打赏
  • 举报
回复
我是说如:st_1这个控件有没有,你怎么这么麻烦啊?我用valid(st_1)好象也不行?
1genut 2001-09-07
  • 打赏
  • 举报
回复
PFC中有一函数可得到数窗中所有object,在循环判断
//////////////////////////////////////////////////////////////////////////////
//
// Function: of_GetObjects (FORMAT 2)
//
// Access: Public
//
// Arguments:
// adw_active:调用DW
// as_objlist[]: A string array to hold objects (passed by reference)
// as_objtype: The type of objects to get (* for all, others defined
// by the object .TYPE attribute)
// as_band: The dw band to get objects from (* for all)
// Valid bands: header, detail, footer, summary
// header.#, trailer.#
// ab_visibleonly: TRUE - get only the visible objects,
// FALSE - get visible and non-visible objects
//
// Returns: Integer
// The number of objects in the array
//
// Description: The following function will parse the list of objects
// contained in the datawindow control associated with this service,
// returning their names into a string array passed by reference,
// and returning the number of names in the array as the return value
// of the function.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright ?1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
string ls_ObjString, ls_ObjHolder
integer li_Start=1, li_Tab, li_Count=0

/* Get the Object String */
ls_ObjString = adw_active.Describe("Datawindow.Objects")

/* Get the first tab position. */
li_Tab = Pos(ls_ObjString, "~t", li_Start)
Do While li_Tab > 0
ls_ObjHolder = Mid(ls_ObjString, li_Start, (li_Tab - li_Start))

// Determine if object is the right type and in the right band
If (adw_active.Describe(ls_ObjHolder + ".type") = as_ObjType Or as_ObjType = "*") And &
(adw_active.Describe(ls_ObjHolder + ".band") = as_Band Or as_Band = "*") And &
(adw_active.Describe(ls_ObjHolder + ".visible") = "1" Or Not ab_VisibleOnly) Then
li_Count ++
as_ObjList[li_Count] = ls_ObjHolder
End if

/* Get the next tab position. */
li_Start = li_Tab + 1
li_Tab = Pos(ls_ObjString, "~t", li_Start)
Loop

// Check the last object
ls_ObjHolder = Mid(ls_ObjString, li_Start, Len(ls_ObjString))

// Determine if object is the right type and in the right band
If (adw_active.Describe(ls_ObjHolder + ".type") = as_ObjType or as_ObjType = "*") And &
(adw_active.Describe(ls_ObjHolder + ".band") = as_Band or as_Band = "*") And &
(adw_active.Describe(ls_ObjHolder + ".visible") = "1" Or Not ab_VisibleOnly) Then
li_Count ++
as_ObjList[li_Count] = ls_ObjHolder
End if

Return li_Count
lesni 2001-09-07
  • 打赏
  • 举报
回复
关注

604

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 控件与界面
社区管理员
  • 控件与界面社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧