of_sendmessage


pfcwnsrv.pbl   >   pfc_n_cst_menu   >   of_sendmessage   

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

Name Datatype
No Data

Name Datatype
li_rc integer
lw_frame window
lw_sheet window

public function integer of_sendmessage (menu am_source, string as_message);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_SendMessage
//
//	Access:  public
//
//	Arguments:
//	am_source		menu that is sending the message
//	as_message	message (event notification) to be sent
//
//	Returns:  integer
//	 1 = Message successfully sent
//	-1 = message could not be sent (use debug object for more info)
//
//	Description:
//	Sends a specified message (event notification) to a receiving window 
//	through the pfc_messagerouter event.
//
//	Sequence:
//	If application is MDI:
//	1) Active MDI sheet pfc_messagerouter event.
//	2) MDI Frame Window pfc_messagerouter event.
//
//	Application is SWI:
//	1) ParentWindow pfc_messagerouter event.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

integer		li_rc = -1
window		lw_frame
window		lw_sheet

// Check arguments
if IsNull (as_message) or Len (Trim (as_message)) = 0 then
	return li_rc
end if

// Determine if application is MDI by getting frame window
of_GetMDIFrame (am_source, lw_frame)   
if IsValid (lw_frame) then

	// Try sending the message to the active MDI sheet
	lw_sheet = lw_frame.GetActiveSheet()
	if IsValid (lw_sheet) then
		li_rc = lw_sheet.dynamic event pfc_messagerouter (as_message)
	end if

	if li_rc <> 1 then
		// Try sending the message to the frame
		li_rc = lw_frame.dynamic event pfc_messagerouter (as_message)
	end if
else
	// Try sending the message to the parentwindow
	if IsValid (am_source.parentwindow) then
		li_rc = am_source.parentwindow.dynamic event pfc_messagerouter (as_message)
	end if
end if

if IsNull (li_rc) then
	li_rc = -1
end if

// Debug message if message could not be received
if li_rc = -1 and IsValid (gnv_app.inv_debug) then
	of_MessageBox ('pfc_menu_msgnotreceived', gnv_app.inv_debug.ics_pfc, &
		"Message " + as_message + " was not received.", Information!, Ok!, 1)
end if

return li_rc

end function

     
Name Owner
pfc_m_master.of_sendmessage pfc_m_master

     
Name Owner
window.getactivesheet window
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.trim systemfunctions
pfc_n_base.of_messagebox pfc_n_base
pfc_n_cst_menu.of_getmdiframe pfc_n_cst_menu

     
Full name
demopfc

     
Name Scope
No Data