|
of_setitemattributes
|
|
Full name
|
pfc_n_cst_tvsrv_levelsource.of_setitemattributes
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_setitemattributes(ref n_ds,long,ref treeviewitem)
|
Name
|
Datatype
|
li_level
|
Integer
|
li_levelcount
|
Integer
|
li_overlay
|
Integer
|
li_picture
|
Integer
|
li_selected
|
Integer
|
li_state
|
Integer
|
ls_key
|
string
|
ls_overlaycolumn
|
string
|
ls_picture
|
string
|
ls_picturecolumn
|
string
|
ls_selectedcolumn
|
string
|
ls_statecolumn
|
string
|
public function integer of_setitemattributes (ref n_ds ads_source, long al_row, ref treeviewitem atvi_item);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_SetItemAttributes
//
// Access: public
//
// Arguments:
// ads_source The DataStore with the data used to populate the item. Passed
// by reference.
// al_Row The row in the DataStore for the item.
// atvi_Item The TreeView item that is being populated. Passed by reference.
//
// Returns: Integer
// Returns 1 if the item was populated successfully, -1 if an error occurrs.
//
// Description: Set the attributes of a TreeView item with data from its DataStore.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.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.
//
//////////////////////////////////////////////////////////////////////////////
Integer li_overlay, li_picture, li_selected, li_state, li_level, li_levelcount
string ls_picturecolumn, ls_statecolumn, ls_overlaycolumn, ls_selectedcolumn
string ls_picture, ls_key
// Validate required reference.
If IsNull(itv_requestor) or Not IsValid(itv_requestor) Then Return -1
If IsNull(ads_source) or Not IsValid(ads_source) Then Return -1
If IsNull(ads_source.inv_base) or Not IsValid(ads_source.inv_base) Then Return -1
SetPointer(Hourglass!)
// determine which level the datastore belongs to
li_level = of_GetLevel(ads_source)
If li_level < 1 then Return -1
// Set Label
atvi_Item.Label = ads_source.inv_base.of_GetItem(al_Row, inv_attrib[li_level].is_LabelColumn)
//// Set Data to the unique key
//ls_key = this.of_encodekey(ads_source, al_Row)
//If ls_key = "!" then return -1
atvi_Item.Data = ""
//
// Set the children attribute
li_levelcount = upperbound(inv_attrib)
If li_level < li_levelcount Or inv_attrib[li_level].ib_Recursive Then
atvi_Item.Children = True
Else
atvi_Item.Children = False
End if
// Set the various picture indexes
ls_picturecolumn = inv_attrib[li_level].is_PictureColumn
If Trim(ls_PictureColumn) <> "" Then
If IsNumber(ls_PictureColumn) Then
// The Picture Index is hard coded
li_picture = Integer(ls_PictureColumn)
ElseIf Left(ads_source.Describe(ls_PictureColumn + ".coltype"), 4) = "char" Then
// The column contains a bmp name, so add the picture
ls_picture = ads_source.GetItemString(al_Row, ls_PictureColumn)
If Not IsNull(ls_picture) Then
li_picture = itv_requestor.AddPicture(ls_picture)
Else
li_picture = 0
End If
Else
// the column contains a index
li_picture = ads_source.GetItemNumber(al_Row, ls_PictureColumn)
If IsNull(li_picture) Then li_picture = 0
End If
End if
atvi_Item.PictureIndex = li_picture
// Set the selected picture for the item - cannot add it to the picture array
ls_selectedcolumn = inv_attrib[li_level].is_SelectedColumn
If Trim(ls_selectedcolumn) <> "" Then
If IsNumber(ls_selectedcolumn) Then
// The Picture Index is hard coded
li_selected = Integer(ls_selectedcolumn)
Else
// the column contains a index
li_selected = ads_source.GetItemNumber(al_Row, ls_selectedcolumn)
If IsNull(li_selected) Then li_selected = 0
End If
End if
atvi_Item.SelectedPictureIndex = li_selected
// Set the state picture for the item
ls_statecolumn = inv_attrib[li_level].is_StateColumn
If Trim(ls_StateColumn) <> "" Then
If IsNumber(ls_StateColumn) Then
// The Picture Index is hard coded
li_state = Integer(ls_StateColumn)
ElseIf Left(ads_source.Describe(ls_StateColumn + ".coltype"), 4) = "char" Then
// The column contains a bmp name, so add the picture
ls_picture = ads_source.GetItemString(al_Row, ls_StateColumn)
If Not IsNull(ls_picture) Then
li_state = itv_requestor.AddStatePicture(ls_picture)
Else
li_state = 0
End If
Else
// the column contains a index
li_state = ads_source.GetItemNumber(al_Row, ls_StateColumn)
If IsNull(li_state) Then li_state = 0
End If
End if
atvi_Item.StatePictureIndex = li_state
// set the overlay picture for the item - cannot add it to the picture array
ls_overlaycolumn = inv_attrib[li_level].is_OverlayColumn
If Trim(ls_overlaycolumn) <> "" Then
If IsNumber(ls_overlaycolumn) Then
// The Picture Index is hard coded
li_overlay = Integer(ls_overlaycolumn)
Else
// the column contains a index
li_overlay = ads_source.GetItemNumber(al_Row, ls_overlaycolumn)
If IsNull(li_overlay) Then li_overlay = 0
End If
End if
atvi_Item.OverlayPictureIndex = li_overlay
Return 1
end function
Name
|
Owner
|
treeview.addpicture |
treeview
|
treeview.addstatepicture |
treeview
|
datastore.describe |
datastore
|
datastore.getitemnumber |
datastore
|
datastore.getitemstring |
datastore
|
systemfunctions.integer |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isnumber |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.setpointer |
systemfunctions
|
systemfunctions.trim |
systemfunctions
|
systemfunctions.upperbound |
systemfunctions
|
pfc_n_cst_tvsrv_levelsource.of_getlevel |
pfc_n_cst_tvsrv_levelsource
|
pfc_n_cst_dssrv.of_GetItem |
pfc_n_cst_dssrv
|