of_setstate


pfcapsrv.pbl   >   pfc_n_cst_security   >   of_setstate   

Full name pfc_n_cst_security.of_setstate
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_setstate(string,string,ref boolean,ref boolean)

Name Datatype
No Data

Name Datatype
li_count integer
li_idx integer
ll_rownbr long
ls_control string
ls_desiredfilter string
ls_findexp string
ls_orig_filter string
ls_status string
ls_win string

protected function integer of_setstate (string as_win, string as_itemname, ref boolean ab_enabled, ref boolean ab_visible);//////////////////////////////////////////////////////////////////////////////
//
//	Function: of_SetState
//
//	Access:  protected
//
//	Arguments : as_win : string; window name
//					as_itemname : string control name
//					ab_enabled : boolean; enabled attribute of the control
//					ab_visible : boolean; visible attribute of the control
//
//	Returns:  Integer
//				0 = Control not found
//				1 = Success
//
//	Description:  Gets the status of the passed window control pair and then sets the
//					passed attributes appropriately. If the attribute is already set to what
//					we want it to be then DO NOT set it again.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//	5.0.03  Added test for isnull(ab_enabled). This allows using this function for setting the visible 
//			attribute for drawobjects which do not have an enabled attribute
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_status
long		ll_rownbr
string	ls_findexp
string 	ls_orig_filter
integer	li_idx, li_count
string	ls_control, ls_win
string	ls_desiredfilter

ls_orig_filter = ids_items.Describe("DataWindow.Table.Filter")

ls_desiredfilter = "window='"+as_win+"'"
If is_currfilter <> ls_desiredfilter Then
	is_currfilter = ls_desiredfilter
	ids_items.SetFilter(is_currfilter)
	ids_items.Filter()
	// resort in case the filter reordered things
	ids_items.sort() 
	il_numberofrows = ids_items.RowCount()
End If

ls_findexp = "window=~""+as_win+"~" AND control=~""+as_itemname+"~""
ll_rownbr = ids_items.Find(ls_findexp, 0, il_numberofrows)

IF ll_rownbr = 0 THEN 
	return 0
End If	

ls_status = ids_items.GetItemString(ll_rownbr, "status")

IF len(ls_status) = 1 THEN
	//   do not reset the enabled attribute if it is already what we want
	if not isnull(ab_enabled) then // if ab_enabled is null then do not change the attribute
		IF ab_enabled AND ((ls_status = DISABLE) OR (ls_status = INVISIBLE)) THEN
			ab_enabled = false
		ELSEIF NOT ab_enabled AND (ls_status = ENABLE) THEN
			ab_enabled = true
		END IF
	end if
	//  If invisible and not already invisible then make invisible
	//  otherwise if enabled and invisible then make visible
	IF ls_status = INVISIBLE AND ab_visible THEN 
		ab_visible = false
	ELSEIF ((ls_status = ENABLE) or (ls_status = DISABLE)) AND NOT ab_visible THEN 
		ab_visible = true
	END IF
	
end if

return 1

end function

     
Name Owner
pfc_n_cst_security.of_setmenustatus pfc_n_cst_security
pfc_n_cst_security.of_setcontrolstatus pfc_n_cst_security

     
Name Owner
datastore.describe datastore
datastore.filter datastore
datastore.find datastore
datastore.getitemstring datastore
datastore.rowcount datastore
datastore.setfilter datastore
datastore.sort datastore
systemfunctions.isnull systemfunctions
systemfunctions.len systemfunctions

     
Full name
No Data

     
Name Scope
No Data