of_AddColumn


pfcmain.pbl   >   pfc_u_lv   >   of_AddColumn   

Full name pfc_u_lv.of_AddColumn
Access public
Extend of integer
Return value integer
Prototype public function integer of_AddColumn(string,string,alignment,integer)

Name Datatype
No Data

Name Datatype
li_Cnt Integer
li_ColCnt Integer
li_Cols Integer
ls_Type String

public function integer of_AddColumn (string as_columnname, string as_columnlabel, alignment aal_alignment, integer ai_columnwidth);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_AddColumn
//
//	Access:  public
//
//	Arguments:
//	as_ColumnName			The column in the DataWindow object to add as a column in
//									the ListView. 
//	as_ColumnLabel			The heading for the column to display in the ListView
//	aal_Alignment			The alignment of the column in the ListView (Left!, Right!, Center!, Justify!).
//	ai_ColumnWidth			The width of the column in the ListView (in PB Units).
//
//	Returns:		Integer
//					The index of the column if added successfully, -1 if an error occurred
//
//	Description:	Add a column to the ListView control.  It will be displayed in Report View only.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_Type
Integer	li_Cols, li_Cnt, li_ColCnt

// Check if the column was previously added
li_Cols = UpperBound(is_Columns)
For li_Cnt = 1 To li_Cols
	If as_ColumnName = is_Columns[li_Cnt] Then
		// Already added, so set new values
		SetColumn(li_Cnt, as_ColumnLabel, aal_Alignment, ai_ColumnWidth)
		Return li_Cnt
	End If
Next

// Set the value in the data source structure
ls_Type  = ids_Source.Describe(as_ColumnName + ".coltype")
If ls_Type = "!" Then Return -1

li_ColCnt = UpperBound(is_Columns) + 1 
is_Columns[li_ColCnt] = as_ColumnName
is_ColType[li_ColCnt] = ls_Type
is_ColFormat[li_ColCnt] = ids_Source.Describe(as_ColumnName + ".format")
If is_ColFormat[li_ColCnt] = "?" Then is_ColFormat[li_ColCnt] = ""

// Add the column to the ListView
Return AddColumn(as_ColumnLabel, aal_Alignment, ai_ColumnWidth)

end function

     
Name Owner
pfc_u_lv.of_AddColumn pfc_u_lv

     
Name Owner
listview.addcolumn listview
listview.setcolumn listview
datastore.describe datastore
systemfunctions.upperbound systemfunctions

     
Full name
No Data

     
Name Scope
No Data