for怎么和loop玩?

piml 2004-08-10 05:18:39

FOR ll_row = 1 to ll_rowcount


This.InsertItemLast(handle, &


ids_info.GetItemString(ll_row, &


music_title'), 2)


LOOP

上面的代码对吗?
...全文
214 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
piml 2004-08-12
  • 打赏
  • 举报
回复


疏漏
cxwsoftware 2004-08-12
  • 打赏
  • 举报
回复
使用for ...next
没有for ...loop的说法!
duckqiu 2004-08-12
  • 打赏
  • 举报
回复
for....next,这点和VB是一样的。
  • 打赏
  • 举报
回复
for .......
.....
......
end for

也得行
兔子-顾问 2004-08-11
  • 打赏
  • 举报
回复
呵呵,没见过。翻译好发上来大家学习一下
piml 2004-08-11
  • 打赏
  • 举报
回复
各位可知道
上面的代码我是从pb9的帮助中贴的阿
Using DataWindow information to populate a TreeView
就是这里面的
shijizhi 2004-08-11
  • 打赏
  • 举报
回复
刚试了一下,无法编译通过,肯定是个BUG
鸡翅多 2004-08-11
  • 打赏
  • 举报
回复
估计是pb9写帮助的人的笔误
我看了确实是loop,呵呵
原文如下:
Using DataWindow information to populate a TreeView
A useful implementation of the TreeView control is to populate it with information that you retrieve from a DataWindow. To do this your application must:


Declare and instantiate a DataStore and assign a DataWindow object
Retrieve information as needed
Use the retrieved information to populate the TreeView
Destroy the DataStore instance when you have finished

Because a TreeView can display different types of information at different levels, you will probably define additional DataWindows, one for each level. Those DataWindows usually refer to different but related tables. When an item is expanded, the item becomes a retrieval argument for getting child items.

Populating the first level
This example populates a TreeView with a list of composers. The second level of the TreeView displays music by each composer. In the database there are two tables: composer names and music titles (with composer name as a foreign key).

This example declares two DataStore instance variables for the window containing the TreeView control:


datastore ids_data, ids_info

This example uses the TreeView control's Constructor event to:


Instantiate the DataStore
Associate it with a DataWindow and retrieve information
Use the retrieved data to populate the root level of the TreeView:

//Constructor event for tv_1treeviewitem tvi1, tvi2long ll_lev1, ll_lev2, ll_rowcount, ll_row//Create instance variable datastoreids_data = CREATE datastoreids_data.DataObject = "d_composers"ids_data.SetTransObject(SQLCA)ll_rowcount = ids_data.Retrieve()//Create the first level of the TreeViewtvi1.PictureIndex = 1tvi1.Children = TRUE//Populate the TreeView with//data retrieved from the datastoreFOR ll_row = 1 to ll_rowcount tvi1.Label = ids_data.GetItemString(ll_row, & 'name') This.InsertItemLast(0, tvi1)NEXT

Populating the second level
When the user expands a root level item, the ItemPopulate event occurs. This script for the event:


Instantiates a second DataStore
Its DataWindow uses the composer name as a retrieval argument for the music titles table.

Inserts music titles as child items for the selected composer
The handle argument of ItemPopulate will be the parent of the new items:

//就在这段,呵呵
//ItemPopulate event for tv_1
TreeViewItem tvi1, tvi2
long ll_row, ll_rowcount
//Create instance variable
datastoreids_info = CREATE datastore
ids_info.DataObject = "d_music"
ids_info.SetTransObject(SQLCA)
//Use the label of the item being populated
// as the retrieval argument
This.GetItem(handle, tvi1)
ll_rowcount = ids_info.Retrieve(tvi1.Label)
//Use information retrieved from the database
//to populate the expanded item
FOR ll_row = 1 to ll_rowcount
This.InsertItemLast(handle, &
ids_info.GetItemString(ll_row, &
music_title'), 2)
LOOP



Destroying DataStore instances
When the window containing the TreeView control closes, this example destroys the DataStore instances:


//Close event for w_treeviewDESTROY ids_dataDESTROY ids_info
10975037 2004-08-10
  • 打赏
  • 举报
回复
FOR ll_row = 1 to ll_rowcount 后面可以加step 是增加的步长

This.InsertItemLast(handle, &

ids_info.GetItemString(ll_row, &

music_title'), 2)

next
------------------------------------------------------
do untill 条件
loop
-------------------------------------------------
do while 条件
loop
haisha 2004-08-10
  • 打赏
  • 举报
回复
不是 for ... loop 是 for ... next

1,076

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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