of_setattributes


pfcmain.pbl   >   pfc_u_lv   >   of_setattributes   

Full name pfc_u_lv.of_setattributes
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_setattributes(long,ref listviewitem)

Name Datatype
No Data

Name Datatype
li_Cnt Integer
li_Cols Integer
li_Overlay Integer
ls_Column String
ls_Label String

protected function integer of_setattributes (long al_row, ref listviewitem alvi_item);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_SetAttributes
//
//	Access:  protected
//
//	Arguments:
//	al_Row							The row in the DataStore to use for the item's attributes.
//	alvi_Item						The pointer to a ListView item whose attributes are to be set.
//										Passed by reference
//
//	Returns:		Integer
//					Returns 1 if successfull, -1 if an error occurred
//
//	Description:	Set the attributes of a ListView item using data from the data source.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//	6.0	Fix bug overlay picture attributes not being set correctly
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_Cnt, li_Cols, li_Overlay
String			ls_Label, ls_Column

// Determine how to handle the pictures
// Picture
If Trim(is_PictureColumn) = "" Then
	alvi_Item.PictureIndex = 0
ElseIf IsNumber(is_PictureColumn) Then
	// The Picture Index is hard coded
	alvi_Item.PictureIndex = Integer(is_PictureColumn)
ElseIf Left(ids_Source.Describe(is_PictureColumn + ".coltype"), 4) = "char" Then
	// The column contains a bmp name, so add the picture
	alvi_Item.PictureIndex = AddLargePicture(ids_Source.GetItemString(al_Row, is_PictureColumn))
	AddSmallPicture(ids_Source.GetItemString(al_Row, is_PictureColumn))
Else
	// The column contains an index
	alvi_Item.PictureIndex = ids_Source.GetItemNumber(al_Row, is_PictureColumn)
End If

// State Picture
If Trim(is_StateColumn) = "" Then
	alvi_Item.StatePictureIndex = 0
ElseIf IsNumber(is_StateColumn) Then
	// The State Picture Index is hard coded
	alvi_Item.StatePictureIndex = Integer(is_StateColumn)
ElseIf Left(ids_Source.Describe(is_StateColumn + ".coltype"), 4) = "char" Then
	// The column contains a bmp name, so add the picture
	alvi_Item.StatePictureIndex = AddStatePicture(ids_Source.GetItemString(al_Row, is_StateColumn))
Else
	// The column contains an index
	alvi_Item.StatePictureIndex = ids_Source.GetItemNumber(al_Row, is_StateColumn)
End If
	
// Overlay Picture
If Trim(is_OverlayColumn) = "" Then
	alvi_Item.OverlayPictureIndex = 0
ElseIf IsNumber(is_OverlayColumn) Then
	// The Picture Index is hard coded
	alvi_Item.OverlayPictureIndex = Integer(is_OverlayColumn)
Else
	// The column contains an index
	alvi_Item.OverlayPictureIndex = ids_Source.GetItemNumber(al_Row, is_OverlayColumn)
End If

// Set the X and Y coordinates
If Trim(is_XPosColumn) = "" Then
	alvi_Item.ItemX = 0
Else
	alvi_Item.ItemX = ids_Source.GetItemNumber(al_Row, is_XPosColumn)
End If
If Trim(is_YPosColumn) = "" Then
	alvi_Item.ItemY = 0
Else
	alvi_Item.ItemY = ids_Source.GetItemNumber(al_Row, is_XPosColumn)
End If

// Set label with data from columns
li_Cols = UpperBound(is_Columns)
For li_Cnt = 1 To li_Cols
	ls_Column = of_FormatData(is_Columns[li_Cnt], is_ColFormat[li_Cnt], is_ColType[li_Cnt], al_Row)
	If Trim(ls_Label) = "" Then
		ls_Label = ls_Column
	Else
		ls_Label = ls_Label + "~t" + ls_Column
	End If
Next
alvi_Item.Label = ls_Label

// Set data to be the created key to be sure it can be found later
alvi_Item.Data = ids_Source.Object.pfc_lvi_key[al_Row]

Return 1

end function

     
Name Owner
pfc_u_lv.of_AddItem pfc_u_lv
pfc_u_lv.of_RefreshItem pfc_u_lv

     
Name Owner
listview.addlargepicture listview
listview.addsmallpicture listview
listview.addstatepicture listview
datastore.describe datastore
datastore.getitemnumber datastore
datastore.getitemstring datastore
systemfunctions.integer systemfunctions
systemfunctions.isnumber systemfunctions
systemfunctions.left systemfunctions
systemfunctions.trim systemfunctions
systemfunctions.upperbound systemfunctions
pfc_u_lv.of_FormatData pfc_u_lv

     
Full name
No Data

     
Name Scope
No Data