Sybase Business Intelligence Solutions - Database Management, Data Warehousing Software, Mobile Enterprise Applications and Messaging
Sybase Brand Color Bar
delete

Search for    in all of Sybase.com
view all search results right arrow
  blank
 
 
 
 
 
Support > Technical Documents > Document Types > Technote > Using the PFC TreeView Object U_TV (PB 7, 8, 9)

Using the PFC TreeView Object U_TV (PB 7, 8, 9)

This Document describes the use of the PFC TreeView control, U_DW, for Powerbuilder 7, 8, and 9
 
RSS Feed
 
 
 
Using the PFC TreeView Object U_TV (PB 7, 8, and 9)

1. Overview

The PFC TreeView class u_tv has been precoded to allow Powerbuilder programmers quick and easy use of the TreeView control. The problem is, you need to know how it's been implemented in order to take advantage of it. This faxline walks through a couple examples of a u_tv implementation. These examples are from pbl's shipped with the PFC
(normally located in
for 7.0 --> files\sybase\PowerBuilder 7.0\examples\appexamp.pbl
for 8 & 9 --> Create a new workspace, and add the target from "pb_install_directory"\PFC\examples\PFC Examples.pbt).

A very high level description of how u_tv has been implemented in the PFC (Powerbuilder Foundation Class library) follows. Each level of the treeview is associated with a datastore. When the user expands the treeview by clicking the "+" the next datastore is retrieved and displayed in the treeview control. This association between the treeview level and a datastore is called "registration" and is done by the of_SetDatasource function. Basically, the programmer registers each treeview level and as the user expands each level the precoded methods from u_tv handle the rest.


Syntax: tv_instancename.of_SetDataSource ( level, dwobject, transaction, labelcolumn, retrieveargs {, recursive {, pictureindex {, selectedindex {, stateindex {, overlayindex } } } } } )

2. Linking a Treeview and Listview together

'

This example window (w_treeviewlistview) has a treeview, a listview and a commandbutton on it. Each of these controls has only one coded event; and the window open event is also coded to make a total of four coded events. The commandbutton's clicked event is a one liner that closes the window; and the listview's constructor event is also a one liner that sets an instance variable. The two events that are of importance for this example are;

Control Event Description
Window Open This event fires when the window is initially opened. It adds several PictureIndexes for the treeview and listview, as well as associating treeview levels with datawindow objects. It also does the initial retrieve that populates the first treeview level. See the line by line explanation following.
tv_1 SelectionChanged This event fires when the user selects another item in the treeview (and after the SelectionChanging event). It checks the current level for the selected treeview item, and associates the listview with datawindow objects and then populates the listview. See the line by line explanation following.

When the user opens this window, it initially displays five regions in the treeview (Canada, Eastern, Central, South, Western) and the states that exist in Canada in the listview. The user can then click one of the regions in the treeview and the states for the region will display in the listview. The user has caused the treeview's SelectionChanged event to fire which in turn populates the listview control with states.

If the user clicks a "+" to the left of one of the regions, that region will expand displaying the states that exist in that region. The states were setup in the window's open event by calling the of_SetDatasource function. If the "+" next to a state is clicked, the customers in that state are displayed (also coded in the windows open event). This causes the treeview's "ItemExpanding" event to fire which populates the next level of the treeview control. Notice that this example does not have any code in the "ItemExpanding" event of tv_1; it's all precoded in the PFC ancestors. Registering the treeview levels using the of_SetDatasource functions allows for this.

2.1 The Window "Open" Event
Following is a line by line explanation of the window w_treeviewlistview open event.

Populate the window title with the classname of the window
this.title = this.title + ' ('+this.ClassName()+')'

tv_1.AddPicture("globals!") This sets up PictureIndex 1 for the treeview
tv_1.AddPicture("parameter!") This sets up PictureIndex 2 for the treeview
tv_1.AddPicture("library!") This sets up PictureIndex 3 for the treeview
tv_1.AddPicture("custom076!") This sets up PictureIndex 4 for the treeview
tv_1.AddPicture("scriptyes!") This sets up PictureIndex 5 for the treeview
tv_1.AddPicture("update!") This sets up PictureIndex 6 for the treeview
tv_1.AddPicture("custom050!") This sets up PictureIndex 7 for the treeview

lv_1.AddLargePicture("globals!") This sets up LargePictureIndex 1 for the listview
lv_1.AddLargePicture("parameter!") This sets up LargePictureIndex 2 for the listview
lv_1.AddLargePicture("library!") This sets up LargePictureIndex 3 for the listview
lv_1.AddLargePicture("custom076!") This sets up LargePictureIndex 4 for the listview
lv_1.AddLargePicture("scriptyes!") This sets up LargePictureIndex 5 for the listview
lv_1.AddLargePicture("update!") This sets up LargePictureIndex 6 for the listview

lv_1.AddSmallPicture("globals!") This sets up SmallPictureIndex 1 for the listview
lv_1.AddSmallPicture("parameter!") This sets up SmallPictureIndex 2 for the listview
lv_1.AddSmallPicture("library!") This sets up SmallPictureIndex 3 for the listview
lv_1.AddSmallPicture("custom076!") This sets up SmallPictureIndex 4 for the listview
lv_1.AddSmallPicture("scriptyes!") This sets up SmallPictureIndex 5 for the listview
lv_1.AddSmallPicture("update!") This sets up SmallPictureIndex 6 for the listview

The next five calls to of_SetDatasource register the datasource for each level of the treeview. This prepares the treeview to be populated later (by the of_populatelevel function). There are five levels,
1. the region (Canada, Eastern, Central, South, Western),
2. state (MA, TX, CA etc),
3. customer company name,
4. sales rep. name, and 5. purchase order number.

The parameters for the of_SetDatasource function are: level, datawindow object, transaction object, column to display as the label, the retrieval arguments, and whether the DW object is to be used recursively. Optional parameters are: picture index, selected picture index, state picture index, and overlay picture index

The first call to of_SetDatasource registers level 1 of the treeview with the Region from the d_region datawindow object. It will not be recursive (false), and the PictureIndex to be used is 1 which is "globals!" (see above), and the SelectedPictureIndex is 7 "custom050", which looks like a open file folder. See figure 1
tv_1.of_SetDatasource(1, "d_region", SQLCA, "region", "", False, 1, 7)

The second call to of_SetDatasource registers level 2 of the treeview with the State from the d_regionstate datawindow object. It will get its retrieval argument from the parent treeviewitem one level above using the "region" column from the datawindow object. It will not be recursive (false), and the PictureIndex to be used is 2 which is "parameter!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(2, "d_regionstate", SQLCA, "states_state_name", ":parent.1.region", False, 2, 7)

The third call to of_SetDatasource registers level 3 of the treeview with the Company name from the d_regionstatecust datawindow object. It will get the first retrieval argument from the parent treeviewitem 2 levels above using the "region" column from the datawindow object, and the second argument from the parent treeviewitem 1 level above using the State (states_state_id) column. It will not be recursive (false), and the PictureIndex to be used is 3 which is "library!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(3, "d_regionstatecust", SQLCA, "customer_company_name", ":parent.2.region, parent.1.states_state_id", False, 3, 7)

The fourth call to of_SetDatasource registers level 4 of the treeview with the Sales Reps. (employee_emp_lname) from the d_regionstatecustrep datawindow object. It will get its retrieval argument from the parent treeviewitem 1 level above using the "customer_id" column from the datawindow object. It will not be recursive (false), and the PictureIndex to be used is 4 which is "custom076!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(4, "d_regionstatecustrep", SQLCA, "employee_emp_lname", ":parent.1.customer_id", False, 4, 7)

The fifth call to of_SetDatasource registers level 5 of the treeview with the Purchase Order # (order_id_string) from the d_regionstatecustrepord datawindow object. It will get the first retrieval argument from the parent treeviewitem 2 levels above using the "customer_id" column from the datawindow object, and the second argument from the parent treeviewitem 1 level above using the Sales Reps. ID (employee_emp_id) column. It will not be recursive (false), and the PictureIndex to be used is 5 which is "scriptyes!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(5, "d_regionstatecustrepord", SQLCA, "order_id_string", ":parent.2.customer_id, ":parent.1.employee_emp_id", False, 5, 7)

Make the initial retrieve for the first level of the above registered TreeViews.
tv_1.of_InitialRetrieve()
 

2.2 The Treeview tv_1 "SelectionChanged" Event

Following is a line by line explanation of the treeview tv_1 selectionchanged event.

Long ll_Parent, ll_Row Declare local variables.
Integer li_RC
Any la_Args[20]
TreeViewItem ltvi_New, ltvi_Parent

SetPointer(HourGlass!) Set the mouse pointer to an hourglass.

Turn off Redraw for the listview so there is no flicker every time an item is added.
lv_1.SetRedraw(False)

Use the "newhandle" event argument to get the new item the user selected.
GetItem(newhandle, ltvi_New)

The next block of code determines the level of the treeview item the user selected and then uses that information to populate the listview control with the same data.
Choose Case ltvi_New.Level
Case 1
For Case 1, if the treeview item selected is level 1, then the states will be displayed in the listview. The d_regionstate datawindow object will be used and the states_state_name column will be the Label of the listview item and the PictureColumn will be 2 (parameter!).
li_RC = lv_1.of_SetDatasource("d_regionstate", SQLCA, "states_state_name", "2")

Case 2
For Case 2, if the treeview item selected is level 2, then the customers will be displayed in the listview. The d_regionstatecust datawindow object will be used and the customer_company_name column will be the Label of the listview item and the PictureColumn will be 3 (library!).
li_RC = lv_1.of_SetDatasource("d_regionstatecust", SQLCA, "customer_company_name", "3")
Case 3
For Case 3, if the treeview item selected is level 3, then the sales reps. will be displayed in the listview. The d_regionstatecustrep datawindow object will be used and the customer_company_name column will be the Label of the listview item and the PictureColumn will be 4 (custom076!).
li_RC = lv_1.of_SetDatasource("d_regionstatecustrep", SQLCA, "employee_emp_lname", "4")
Case 4
For Case 4, if the treeview item selected is level 4, then the purchase order # will be displayed in the listview. The d_regionstatecustrepord datawindow object will be used and the sales_order_cust_id column will be the Label of the listview item and the PictureColumn will be 4 (custom076!).
li_RC = lv_1.of_SetDatasource("d_regionstatecustrepord", SQLCA, "sales_order_cust_id", "5")
Case 5
For Case 5, if the treeview item selected is level 5, then the purchase order items will be displayed in the listview. The d_regionstatecustreporditm datawindow object will be used and the product_description column will be the Label of the listview item and the PictureColumn will be product_picture_name.
li_RC = lv_1.of_SetDatasource("d_regionstatecustreporditm", SQLCA, "product_description", "product_picture_name")
End Choose

If there is a problem with the return code of of_SetDatasource then display a message and exit out of this event
If li_RC < 0 Then
MessageBox("Error", "Error in of_SetDatasource", Exclamation!)
Return
End If
Now that the listview properties have been registered (using of_SetDatasource), add the listview columns (display only in listview report format). PFC will get the columns from the referenced datawindow object for each level (from of_SetDatasource). If the selected treeview level is 1 (regions) then states will display in the listview. If the listview is displayed in report format, it will have not only the states but also each states state capital, country and region it's in, and ID (CA for California), as detailed in the datawindow object d_regionstate.
lv_1.of_AddColumns()

In this example, the Treeview and Listview are displaying the same information (the listview has more details if in report mode) and using the same datawindow objects. Therefore, they use the same retrieval arguments. U_tv provides an object function that will get the arguments of a previously populated treeview item (that used of_SetDatasource)
If ltvi_New.Level < 5 Then
of_GetArgs(newhandle, (ltvi_New.Level + 1), la_Args)
Else
la_Args[1] = Integer(ltvi_New.Label)
End If
Now that the arguments for the corresponding treeview item have been retrieved (using of_GetArgs or hardcoded), we can go ahead and populate the listview.
lv_1.of_populate(la_Args)

lv_1.SetRedraw(True)

3. Linking a Treeview and Datawindow together


This window (w_treeview) has a treeview control, datawindow control, and several commandbuttons. The significant source code in this window is in the window open and the treeview selectionchanging events.

Control Event Description
Window Open Fires when the window is initially opened. It adds several PictureIndexes for the treeview, as well as associating treeview levels with datawindow objects. It also does the initial retrieve that populates the first treeview level. See the line by line explanation following.
tv_1 SelectionChanging Fires when the user selects another item in the treeview (and before the SelectionChanged event). It determines what level the selected treeview item is at, gets the datastore associated with it and copies the data to the datawindow control dw_1.
dw_1 Clicked Fires when the user clicks the datawindow control. This highlights the only row in the datawindow.
sle_Level (none)
cb_RefreshLevel clicked Fires when the user clicks this commandbutton. Refreshes the treeview level that's specified in the sle_level singlelineedit control.
cb_RefreshItem clicked Fires when the user clicks this commandbutton. Refreshes the treeview's current item.
cb_RefreshTree clicked Fires when the user clicks this commandbutton. Refreshes the whole treeview and all its levels.
cb_InsertRow clicked Fires when the user clicks this commandbutton. Inserts a new row in the datawindow control dw_1.
cb_DeleteItem clicked Fires when the user clicks this commandbutton. Deletes the treeview's current item.
cb_UpdateTree clicked Fires when the user clicks this commandbutton. Copies data from the datawindow control to a treeview item.
cb_Close clicked Fires when the user clicks this commandbutton. Closes the window.

When the user opens this window, it initially displays five regions in the treeview (Canada, Eastern, Central, South, Western) in the datawindow. The user can then click one of the regions in the treeview and that region will display in the datawindow. By doing this the user has caused the treeview's SelectionChanging event to fire which in turn populates the datawindow control with the region.

If the user clicks a "+" to the left of one of the regions, that region will expand displaying the states that exist in that region. The states were setup in the windows open event by calling the of_SetDatasource function. If the "+" next to a state is clicked, the customers in that state are displayed (also setup in the windows open event). By doing this the user has caused the treeview's "ItemExpanding" event to fire which populates the next level of the treeview control. Notice that this example doesn't have any code in the "ItemExpanding" event of tv, it's all precoded in the PFC ancestors. Registering the treeview levels using the of_SetDatasource functions allows for this.

When the user selects a treeview item by clicking on one, the treeview's SelectionChanging event fires which will populate the datawindow control with the appropriate data depending on the level of the treeview item. That is if a region is selected in the treeview, the datawindow will display the region again; if a state is selected in the treeview the datawindow will display the state name, capital and country; and if customer is selected in the treeview, the data for that customer is displayed in the datawindow.

3.1 The Window "Open" Event

Following is a line by line explanation of the window w_treeview open event.

Populate the window title with the classname of the window
this.title = this.title + ' ('+this.ClassName()+')'

tv_1.AddPicture("globals!") This sets up PictureIndex 1 for the treeview
tv_1.AddPicture("parameter!") This sets up PictureIndex 2 for the treeview
tv_1.AddPicture("library!") This sets up PictureIndex 3 for the treeview
tv_1.AddPicture("custom076!") This sets up PictureIndex 4 for the treeview
tv_1.AddPicture("scriptyes!") This sets up PictureIndex 5 for the treeview
tv_1.AddPicture("update!") This sets up PictureIndex 6 for the treeview
tv_1.AddPicture("custom050!") This sets up PictureIndex 7 for the treeview

The next six calls to of_SetDatasource register the datasource for each level of the treeview. This prepares the treeview to be populated later (by the of_populatelevel function). There are five levels, 1. the region (Canada, Eastern, Central, South, Western), 2. state (MA, TX, CA etc), 3. customer company name, 4. sales rep. name, and 5. purchase order number.
The parameters for the of_SetDatasource function are: level, datawindow object, transaction object, column to display as the label, the retrieval arguments, and whether the DW object is to be used recursively. Optional parameters are: picture index, selected picture index, state picture index, and overlay picture index

The first call to of_SetDatasource registers level 1 of the treeview with the Region from the d_region datawindow object. It will not be recursive (false), and the PictureIndex to be used is 1 which is "globals!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(1, "d_region", SQLCA, "region", "", False, 1, 7)

The second call to of_SetDatasource registers level 2 of the treeview with the State from the d_regionstate datawindow object. It will get its retrieval argument from the parent treeviewitem 1 level above using the "region" column from the datawindow object. It will not be recursive (false), and the PictureIndex to be used is 2 which is "parameter!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(2, "d_regionstate", SQLCA, "states_state_name", ":parent.1.region", False, 2, 7)

The third call to of_SetDatasource registers level 3 of the treeview with the Company name from the d_regionstatecust datawindow object. It will get the first retrieval argument from the parent treeviewitem 2 levels above using the "region" column from the datawindow object, and the second argument from the parent treeviewitem 1 level above using the State (states_state_id) column. It will not be recursive (false), and the PictureIndex to be used is 3 which is "library!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(3, "d_regionstatecust", SQLCA, "customer_company_name", ":parent.2.region, parent.1.states_state_id", False, 3, 7)

The fourth call to of_SetDatasource registers level 4 of the treeview with the Sales Reps. (employee_emp_lname) from the d_regionstatecustrep datawindow object. It will get its retrieval argument from the parent treeviewitem 1 level above using the "customer_id" column from the datawindow object. It will not be recursive (false), and the PictureIndex to be used is 4 which is "custom076!" (see above), and the SelectedPictureIndex is 7 "custom050" which looks like a open file folder.
tv_1.of_SetDatasource(4, "d_regionstatecustrep", SQLCA, "employee_emp_lname", ":parent.1.customer_id", False, 4, 7)

The fifth call to of_SetDatasource registers level 5 of the treeview with the Purchase Order # (order_id_string) from the d_regionstatecustrepord datawindow object. It will get the first retrieval argument from the parent treeviewitem 2 levels above using the "customer_id" column from the datawindow object, and the second argument from the parent treeviewitem 1 level above using the Sales Reps. ID (employee_emp_id) column. It will not be recursive (false), and the PictureIndex to be used is 5 which is "scriptyes!" (see above), and the SelectedPictureIndex is 7 "custom050!" which looks like a open file folder.
tv_1.of_SetDatasource(5, "d_regionstatecustrepord", SQLCA, "order_id_string", ":parent.2.customer_id, ":parent.1.employee_emp_id", False, 5, 7)
The sixth call to of_SetDatasource registers level 6 of the treeview with the Purchase Order item description (product_description) from the d_regionstatecustreporditm datawindow object. It will get the retrieval argument from the parent treeviewitem 1 level above using the purchase order. ID (sales_order_id) column. It will not be recursive (false), and the PictureIndex to be used is 6 which is "update!" (see above), and the SelectedPictureIndex is 7 "custom050!" which looks like a open file folder.
tv_1.of_SetDatasource(6, "d_regionstatecustreporditm", SQLCA, "product_description", ":parent.1.sales_order_id", False, 6, 7)

Make the initial retrieve for the first level of the above registered TreeViews.
tv_1.of_InitialRetrieve()
 

3.2 The Treeview tv_1 "SelectionChanging" Event

Following is a line by line explanation of the treeview tv_1 selectionchanging event.

n_ds ls_DataStore Declare local variables
TreeViewItem ltvi_New

SetPointer(HourGlass!) Set the mouse pointer to an hourglass.

Turn off Redraw for the dw so there is no flicker when data is added.
dw_1.SetRedraw(False)

Use the "newhandle" event argument to get the new treeview item the user selected.
GetItem(newhandle, ltvi_New)

Get the data and row# of the clicked treeview item associated with "newhandle", display an error message if a problem occurs. The il_DSRow instance variable is significant and is used to store the row # in the datastore of the associated selected treeview item. This il_DSRow is referenced by other methods in the window.
If of_GetDataRow(newhandle, lds_DataStore, il_DSRow) = -1 Then
MessageBox("Error", "Error in of_get_data_row", exclamation!)
End If

dw_1.Reset()
dw_1.DataObject = lds_DataStore.DataObject Set dw_1 to use the new DataStore.

Copy only the data from the selected item to the datawindow.
lds_DataStore.RowsCopy(il_DSRow, il_DSRow, Primary!, dw_1, 1, Primary!)

Set status flag of new row (the new row is copied as NewModified!).
Choose Case lds_DataStore.GetItemStatus(il_DSRow, 0, Primary!)
Case New!
dw_1.SetItemStatus(1, 0, Primary!, NotModified!)
Case DataModified!
dw_1.SetItemStatus(1, 0, Primary!, DataModified!)
Case NotModified!
dw_1.SetItemStatus(1, 0, Primary!, DataModified!)
dw_1.SetItemStatus(1, 0, Primary!, NotModified!)
End Choose

dw_1.SetRedraw(True)

3.3 The Datawindow dw_1 "Clicked" Event

Following is a line by line explanation of the datawindow dw_1 clicked event:

SelectRow(0, False) Select 0 rows (deselect all rows).
SelectRow(row, True) Select the clicked row.

3.4 The CommandButton cb_RefreshLevel "Clicked" Event

Following is a line by line explanation of the commandbutton cb_RefrshLevel clicked event.

dw_1.Reset() Clear out the datawindow.
tv_1.of_RefreshLevel(Integer(sle_level.Text)) Refresh the treeview level specified in the sle_level.

3.5 The CommandButton cb_RefreshItem "Clicked" Event

Following is a line by line explanation of the commandbutton cb_RefreshItem clicked event.

dw_1.Reset() Clear out the datawindow.

Refresh the Treeview item that was most recently selected by the user (il_DSRow).
tv_1.of_RefreshItem(tv_1.FindItem(CurrentTreeItem!, 0), il_DSRow)

3.6 The CommandButton cb_RefreshTree "Clicked" Event

Following is a line by line explanation of the commandbutton cb_RefreshTree clicked event:

dw_1.Reset() Clear out the datawindow.

Removes all Treeview items below a specified item (0 means all levels). The function also removes the item's rows from the DataStores.
tv_1.of_DiscardChildren(0)

Make an initial retrieve for the first level of the registered Treeviews.
tv_1.of_InitialRetrieve()

3.7 The CommandButton cb_InsertRow "Clicked" Event

Following is a line by line explanation of the commandbutton cb_InsertRow clicked event:

dw_1.RowsDiscard(1, 1, Primary!) Delete the row from the datawindow.
dw_1.InsertRow(0) Insert a blank row.

3.8 The CommandButton cb_DeleteItem "Clicked" Event

Following is a line by line explanation of the commandbutton cb_DeleteItem clicked event:

Long ll_Current

ll_Current = tv_1.FindItem(CurrentTreeItem!, 0) Get the handle to the current treeview item.
If tv_1.of_DeleteItem(ll_Current) = -1 Then Delete the current treeview item.
MessageBox("Error", "Error in of_delete_item", Exclamation!)
Return
End If

3.9 The CommandButton cb_UpdateTree "Clicked" Event

Following is a line by line explanation of the commandbutton cb_UpdateTree clicked event:

Long ll_Current Declare local variables.
n_ds lds_DataStore
TreeViewItem ltvi_Current

ll_Current = tv_1.FindItem(CurrentTreeItem!, 0) Get the handle to the current treeview item.
tv_1.GetItem(ll_Current, ltvi_Current) Get the properties of the current treeview item.

Populate lds_DataStore with the properties of the datastore for the current treeview level.
If tv_1.of_GetDatastore(ltvi_Current.Level, lds_DataStore) = -1 Then
MessageBox("Error", "Error in of_get_datastore", Exclamation!)
Return
End If

Copy the data from the datawindow to the treeview item's datastore.
Choose Case dw_1.GetItemStatus(1, 0, Primary!)

If the dw itemstatus is new! or newmodified!
Case New!, NewModified!

Copy the rows to the datastore
dw_1.RowsCopy(1, 1, Primary!, lds_DataStore, 999999, Primary!)

Add an item to the parent level of the treeview.
ll_Current = tv.of_InsertItem(tv_1.FindItem(ParentTreeItem!, ll_Current), lds_DataStore,& lds_DataStore.RowCount(), "Last")
If ll_Current = -1 Then
MessageBox("Error", "Error in of_InsertItem", Exclamation!)
Return
End If
tv_1.SelectItem(ll_Current)

If the dw itemstatus is datamodified!
Case DataModified!

Discard the original row from the DataStore.
lds_DataStore.RowsDiscard(il_DSRow, il_DSRow, Primary!)

Copy the rows to the datastore.
dw_1.RowsCopy(1, 1, Primary!, lds_DataStore, il_DSRow, Primary!)

Reset the itemstatus flag in the ds.
lds_DataStore.SetItemStatus(il_DSRow, 0, Primary!, DataModified!)

Refresh the current treeview item.
If tv_1.of_RefreshItem(ll_Current, il_DSRow) = -1 Then
MessageBox("Error", "Error in of_RefreshItem", Exclamation!)
Return
End If
End Choose

3.10 The CommandButton cb_close "Clicked" Event

Following is a line by line explanation of the commandbutton cb_close clicked event:

parent.event pfc_close() Close the window.


 

DOCUMENT ATTRIBUTES
Last Revised: May 09, 2003
Product: PowerBuilder
Technical Topics: Application Development
  
Business or Technical: Technical
Content Id: 47729
Infotype: Technote
 
 
 

© Copyright 2013, Sybase Inc. - v 7.6 Home / Contact Us / Help / Jobs / Legal / Privacy / Code of Ethics