of_setenabled


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_querymode   >   of_setenabled   

Full name pfc_n_cst_dwsrv_querymode.of_setenabled
Access public
Extend of integer
Return value integer
Prototype public function integer of_setenabled(boolean)

Name Datatype
No Data

Name Datatype
lb_querycolumn boolean
li_i integer
li_numquerycols integer
ls_modify string
ls_rc string

public function integer of_setenabled (boolean ab_switch);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_SetEnabled
//
//	Access:  Public
//
//	Arguments: 
//   ab_switch
//	TRUE turns QueryMode on, 
//	FALSE turns QueryMode off
//
//	Returns:  integer
//	 1 = success
//	-1 = error
//
//	Description:
//	Toggles querymode settings on and off based on argument
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
// 6.0	Check that at least one QueryColumn has been requested prior to 
//			disabling/enabling columns.
// 7.0	If QueryMode is turned off, notify the dw that the row has changed
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1999 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_numquerycols
integer		li_i
string		ls_rc
string		ls_modify
boolean		lb_querycolumn

// Verify passed arguments.
if IsNull (ab_switch) then return -1  

// Check the datawindow reference.
if IsNull(idw_requestor) Or not IsValid (idw_requestor) then
	return -1
end if

// Disable the Redraw during the operation.
idw_requestor.SetReDraw (false)

// Get the upperbound of the querymode stored information.
li_numquerycols = UpperBound (inv_querymodeinfo)

// Check that at least one QueryColumn has been requested.
lb_querycolumn = (UpperBound(is_querycolumns) > 0)

choose case ab_switch

		case true
			// Clear prior QueryMode criteria if necessary
			if ib_resetcriteria then idw_requestor.Object.DataWindow.QueryClear = "yes"

			// Put the datawindow into QueryMode state
			idw_requestor.Object.DataWindow.QueryMode = "yes"

			// Check that at least one QueryColumn has been requested prior to 
			//	disabling/enabling columns.
			If lb_querycolumn Then
				// Build Modify string to change all the appropriate properties
				for li_i = 1 to li_numquerycols
					if inv_querymodeinfo[li_i].b_state = false then
						// Add to modify string to protect for non-querymode columns
						ls_modify = ls_modify + inv_querymodeinfo[li_i].s_col + ".Protect = 1 " 
					else
						// Add to modify string to non-protect for querymode columns.
						ls_modify = ls_modify + inv_querymodeinfo[li_i].s_col + ".Protect = 0 " 
					end if
				next
			
				// Execute the Modify string changing all the appropriate properties
				ls_rc = idw_Requestor.Modify (ls_modify)
				if ls_rc <> "" then
					idw_requestor.SetRedraw (true)
					return -1
				end if
			end if

		case false
			// Turn off QueryMode
			idw_Requestor.Object.DataWindow.QueryMode = "no"

			// Build Modify string to Reset all the appropriate properties
			for li_i = 1 to li_numquerycols
				// Add to Modify string to restore the protect property
				ls_modify = ls_modify + inv_querymodeinfo[li_i].s_col + &
						".Protect = " + inv_querymodeinfo[li_i].s_protect + " " 
			next

			// Execute the Modify string
			ls_rc = idw_requestor.Modify (ls_modify)
			if ls_rc <> "" then
				idw_requestor.SetRedraw (true)
				return -1
			end if

			// Perform retrive if appropriate.
			if ib_retrieveondisabled then
				idw_requestor.event pfc_retrieve () 
			end if
			
			idw_requestor.Event pfc_rowchanged ( ) 

end choose

idw_requestor.SetReDraw (true)
return 1
end function

     
Name Owner
pfc_n_cst_dwsrv_querymode.of_load pfc_n_cst_dwsrv_querymode
w_resp_employee.cb_search.clicked cb_search
w_resp_employee.pfc_postopen w_resp_employee
w_resp_sales_order.cb_search.clicked cb_search
w_resp_sales_order.pfc_postopen w_resp_sales_order
w_resp_salesperson.cb_search.clicked cb_search
w_resp_salesperson.pfc_postopen w_resp_salesperson
pfc_u_tabpg_dwproperty_srvquerymode.pfc_propertyapply pfc_u_tabpg_dwproperty_srvquerymode

     
Name Owner
dragobject.setredraw dragobject
datawindow.modify datawindow
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.upperbound systemfunctions
pfc_u_dw.pfc_retrieve pfc_u_dw
pfc_u_dw.pfc_rowchanged pfc_u_dw

     
Full name
No Data

     
Name Scope
No Data