|
of_setdatawindowcolumns
|
|
Full name
|
pfc_n_cst_security.of_setdatawindowcolumns
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_setdatawindowcolumns(datawindow)
|
Name
|
Datatype
|
li_count
|
integer
|
li_idx
|
integer
|
li_posi
|
integer
|
li_rc
|
integer
|
ls_column
|
string
|
ls_currentstatus
|
string
|
ls_modstring
|
string
|
ls_result
|
string
|
protected function integer of_setdatawindowcolumns (datawindow adw_obj);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_SetDataWindowColumns
//
// Access: protected
//
// Arguments:
// adw_obj datawindow
//
// Returns: integer
// the number of columns set
// -1 = error occured
//
// Description: Sets the columns on the passed datawindow control based on the current
// contents of the ids_items datastore.
//
// Note: The ids_items datastore must have already been filtered appropriately
// before calling this function.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_idx, li_posi, li_rc, li_count
string ls_currentstatus, ls_column, ls_modstring, ls_result
// resort in case the filter reordered things
ids_items.sort()
il_numberofrows = ids_items.RowCount()
If il_numberofrows > 0 Then
For li_idx = 1 To il_numberofrows
ls_modstring = ""
ls_currentstatus = ids_items.GetItemString (li_idx, "status")
ls_column = ids_items.GetItemString (li_idx, "control")
// get the column name. There may be control names before it.
li_posi = pos(ls_column,".")
Do While li_posi > 0
ls_column = mid(ls_column, li_posi + 1)
li_posi = pos(ls_column,".")
Loop
// column/object to secure must be in the datawindow
ls_result = adw_obj.Describe(ls_column+'.name')
If ls_result = "!" Then Continue
// If column becomes disabled or invisible, disable the column by protecting it
If ls_currentstatus = "D" or ls_currentstatus = "I" Then
ls_modstring = ls_column + ".border=~""+is_disabledborder+"~" " + &
ls_column + ".protect=~"1~" "
end if
// if column becomes enabled then enable by unprotecting the column and make it visible
If ls_currentstatus = "E" Then
ls_modstring = ls_column + ".protect=~"0~" "+ ls_column + ".visible=~"1~" "
end if
// If column becomes invisible then make it invisible
If ls_currentstatus = "I" Then
ls_modstring += ls_column + ".visible=~"0~" "
End If
ls_result = adw_obj.Modify(ls_modstring)
If ls_result <> "" Then
of_messagebox('pfcsecurity_setdatawindowcolumns', 'Modify failed '+ls_result, ls_modstring, &
Information!, OK!, 1)
Return -1
End If
li_count++
Next
End If
return li_count
end function
Name
|
Owner
|
datawindow.describe |
datawindow
|
datawindow.modify |
datawindow
|
datastore.getitemstring |
datastore
|
datastore.rowcount |
datastore
|
datastore.sort |
datastore
|
systemfunctions.mid |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
pfc_n_base.of_messagebox |
pfc_n_base
|