compile function scroll_enable( EditBoxes, EditTables )

$insert logical
equ EditTableInsDel$   to 4    ;* ALLOW ROW INSERTION AND/OR DELETION FOR EDITTABLE STYLE
equ Protected$         to 8    ;* AS DOCUMENTED IN THE COLSYTLE MESSAGE IN HELP
equ ReadOnly$          to 2048 ;* FIGURED THIS OUT BY SETTING THE STYLE IN THE WINDOW THEN DEBUGGING

declare function fieldcount, utility, send_message, get_property, set_property

* PROTECT ALL CELLS IN EACH EDITTABLE, THIS WILL ALLOW SCROLLING
* FOR INDIVIDUALS WITH ONLY READ RIGHTS

* WHEN CALLING THIS FUNCTION AND YOU WANT ALL CONTROLS ON THE WINDOW TO BE SCROLL ENABLED
* BUT PROTECTED THEN THE CALLING  SYNTAX IS Void = scroll_enable()

* WHEN CALLING THIS FUNCTION AND YOU WANT ONLY SPECIFICT CONTROLS ON A WINDOW TO BE SCROLL
* ENABLED THEN THE CALLING SYNTAX IS 
         * Void = scroll_enable( '', @window:'CONTROL1':@FM:'CONTROL2' )
                                  * OR
         * Void = scroll_enable( @window:'CONTROL1':@FM:'CONTROL2', '' )
* MAKING SURE THAT YOU PASS NULL IN THE PARAM YOU ARE NOT USING OTHERWISE IT 
* WILL GRAB ALL ON THE CURRENT @WINDOW
                                  
if Assigned(EditTables) else
	EditTables = utility( 'OBJECTLIST', @window, 'EDITTABLE' )
end
ETCnt = fieldcount( EditTables, @fm )     
for i = 1 to ETCnt
	ThisEditTable = EditTables<i>
	ColCount = get_property( ThisEditTable, "LIMIT" )<1>
	Styles = send_message( ThisEditTable, "COLSTYLE", 0, '' )
	for j = 1 to ColCount
	   Styles<j> = bitor( Styles<j>, Protected$ )
	next j
	Void = send_message( ThisEditTable, "COLSTYLE", 0, Styles )
	Style = get_property( ThisEditTable, "STYLE" )
	if Style[1,2] _eqc "0x" then
	   convert @lower_case to @upper_case in Style
	   Style = iconv( Style[3,999], 'MX' )
	end
	Style = bitand( Style, bitnot(EditTableInsDel$) )
	Void = set_property( ThisEditTable, 'STYLE', Style ) 
next i
convert @fm to @rm in EditTables
Void = set_property( EditTables, 'ENABLED', 1 )

* NOW MAKE THE EDIT BOXES READONLY, THIS WILL ALLOW SCROLLING
* FOR INDIVIDUALS WITH ONLY READ RIGHTS
if Assigned(EditBoxes) else
	EditBoxes = utility( 'OBJECTLIST', @window, 'EDITBOX' )
end	
EBCnt = fieldcount( EditBoxes, @fm )
for i = 1 to EBCnt
	ThisEditBox = EditBoxes<i>
	Style = get_property( ThisEditbox, "STYLE" )
	if Style[1,2] _eqc "0x" then
	   convert @lower_case to @upper_case in Style
	   Style = iconv( Style[3,999], 'MX' )
	end
   Style = bitor( Style, ReadOnly$ )
	Void = set_property( ThisEditBox, 'STYLE', Style )
next i
convert @fm to @rm in EditBoxes
Void = set_property( EditBoxes, 'ENABLED', 1 )
return 0

