of_triggerevent


pfcwnsrv.pbl   >   pfc_n_cst_menu   >   of_triggerevent   

Full name pfc_n_cst_menu.of_triggerevent
Access public
Extend of integer
Return value integer
Prototype public function integer of_triggerevent(menu,string)

Name Datatype
No Data

Name Datatype
lb_frame_exists boolean
lw_frame window
lw_obj window
lw_sheet window

public function integer of_triggerevent (menu am_source, string as_event);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_TriggerEvent
//
//	Access:  		public
//
//	Arguments:		
//	am_source		The menu for which to trigger the event.
// as_event			The name of the event to be triggered
//
//	Returns:  		integer
//						 1 Event triggered successfully. 
//						-1 if the event is not a valid event, or no script
//							exists for the event.
//
//	Description:  	Triggers the event name specified on the active MDI sheet.
//
//		Sequence:
//			If application is MDI:
//				1) Active MDI sheet triggerevent
//				2) MDI Frame Window triggerevent
//
//			Application is SWI:
//				3) ParentWindow triggerevent
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

window	lw_frame, &
			lw_sheet, &
			lw_obj
boolean	lb_frame_exists=False

//Check arguments
If Not IsValid(am_source) or IsNull(am_source) Then
	Return -1
End If

//////////////////////////////////////////////////////////////////////////////
//Get the frame window (if any)
//////////////////////////////////////////////////////////////////////////////
of_GetMDIFrame(am_source, lw_frame)
if Not IsNull (lw_frame) And IsValid (lw_frame) Then
	lb_frame_exists = True
End If

//////////////////////////////////////////////////////////////////////////////
// Try triggering the event on the active MDI sheet
//////////////////////////////////////////////////////////////////////////////
If lb_frame_exists Then
	lw_sheet = lw_frame.GetActiveSheet()
	if IsValid (lw_sheet) then
		Return lw_sheet.TriggerEvent (as_event)
	End If
End If

//////////////////////////////////////////////////////////////////////////////
// There is no active MDI sheet. 
// Try triggering the event on the MDI Frame
//////////////////////////////////////////////////////////////////////////////
If lb_frame_exists Then
	Return lw_frame.TriggerEvent (as_event)	
End If

//////////////////////////////////////////////////////////////////////////////
// There is no MDI frame.
//	Trigger the event on the ParentWindow
//////////////////////////////////////////////////////////////////////////////
lw_obj = am_source.ParentWindow
Return lw_obj.TriggerEvent (as_event)		

end function

     
Name Owner
No Data

     
Name Owner
powerobject.triggerevent powerobject
window.getactivesheet window
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
pfc_n_cst_menu.of_getmdiframe pfc_n_cst_menu

     
Full name
No Data

     
Name Scope
No Data