Function Utility_Services(Service, Error, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10)

/********************************************************************************************************

    This program is proprietary and is not to be used by or disclosed to others, nor is it to be
    copied without written permission from SRP Computer Solutions, Inc.

    Name        :   Utility Services

    Description :   Handler program for all module related services.

    Notes       :   The generic paramters should contain all the necessary information to process
					the services. Often this will be information like the data Record and Key ID.

    Parameters  :
        Service         [in] -- Name of the service being requested
        Error          [out] -- Any errors that were created
        Param1-10   [in/out] -- Additional request parameter holders
        Response       [out] -- Response to be sent back to the Controller (MCP) or requesting procedure

    History     :   (Date, Initials, Notes)
        08/13/10    dmb     Original programmer
        08/27/10	fjt		Initial development

********************************************************************************************************/

$insert SRP_APP_INSERTS
$insert SERVICE_INSERT

Begin Case
	Case Service _eqc 'Balloon'             ;   GoSub Balloon
    Case Service _eqc 'Test'                ;   GoSub Test
    Case Otherwise$                         ;   Error = 'Invalid Service'
End Case

If Assigned(Response) else Response = ''
Return Response


!----- SERVICES -----------------------------------------------------------------------------------------


Balloon:
	// Shows a balloon status message
	// Assumes the form has an OLE_SUBCLASS control on it
	Ctrl  = Param1
	Title = Param2
	Mtext = Param3
	Icon  = Param4
	Delay = Param5
	Cell  = Param6
		
	If Mtext EQ "" then Mtext = "An error has occurred"
	If Title EQ "" then Title = "Error"
	If Icon  EQ "" then Icon  = 3
	If Delay EQ "" then Delay = 3000
	Swap @VM with @TM in Mtext
		
    If Num(Icon) else
        Begin Case
            Case Icon EQ "N" ; Icon = 0
            Case Icon EQ "I" ; Icon = 1
            Case Icon EQ "W" ; Icon = 2
            Case Icon EQ "E" ; Icon = 3
        End Case
    end

	Config = ""
	Config<1> = Mtext
	Config<2> = Title
	Config<3> = Icon
	Config<4> = Delay

	If (Cell EQ "") then
		SubClasser = @Window:".OLE_SUBCLASS"
		Handle = Get_Property(Ctrl, "HANDLE")
		rv = Send_Message(SubClasser, "OLE.Subclass", Handle, Ctrl)
	end

	CtrlId = Ctrl
	Convert "." to ";" in CtrlId
	If (Cell GT "") then
		CtrlId = Cell
		SubClasser = Ctrl
		Swap ";" with @FM in Cell
	end	
	Response = Send_Message(SubClasser, "OLE.ShowBalloonTooltip", CtrlId, Config)
return


Test:
    Response = '<Service Response>'
return
