Function svc_Ext_Summary_Popup(Service, Rows, Param2)

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

    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        :   Orders Events

    Description :   Commuter module for the above window

    Tag			:   [SRP]

    Parameters  :   Standard event parameters

    History (Date, Initials, Notes)
        01/30/2008	fjt		Initial development		

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

$insert SRP_APP_INSERTS
$insert SERVICE_INSERT

Equ Popup$ to @Window:".POPUP"
Equ Font$  to "Tahoma":@SVM:"-12" :@SVM: 400 :@SVM:0:@SVM:0:@SVM:0:@SVM:0:@SVM:34:@SVM:0:@SVM:3:@SVM:2:@SVM:1:@SVM:0:@SVM:0:@SVM:0:@SVM:0

* Declare subroutine Format_Rec_Text

Begin Case
	Case Service _eqc "Init"	; GoSub Init
	Case Service _eqc "Show"	; GoSub Show
End Case

If Assigned(Ans) else Ans = ""
Return Ans


!----- METHODS ------------------------------------------------------------------------------------------


INIT:
	Set_Property(Popup$, "OLE.Theme", "Custom")
	Set_Property(Popup$, "OLE.Animation", "N")
* 	Set_Property(Popup$, "OLE.AnimationDelay", 256)
	Set_Property(Popup$, "OLE.ShowDelay", 500)
return


SHOW:
	x = Param2<1>
	y = Param2<2>

	Rows<1> = "Test"
	Rows<2> = "Two 2"
	
	Cnt   = Count(Rows, @FM) + (Rows NE "")
	
	Width = 0

	// Determine width	
	For i = 1 to Cnt
		Row  = Rows<i>
		Rect = Utility("TEXTRECT", "", Row :@FM: (0 + 1024 + 16) :@FM: 640 :@FM: Font$)
		If Rect<1> GT Width then Width = Rect<1>
	Next i

	// Set the vars
	Items    = ""
	Margin_L = 10
	Margin_T = 20
	RH		 = 18

	// Build the item list
	For i = 1 to Cnt	
		Items<i,1> = (x + Margin_L) :@SVM: (y + Margin_T) :@SVM: Width :@SVM: RH
		Items<i,2> = Rows<i>
		y += RH
	Next i

	// Size information
	Size    = 0
	Size<2> = 0
	Size<3> = 250 ;// width
	Size<4> = 250 ;// height	(RH * Cnt) + Margin_T + RH
	
	// Set the items and display
	Set_Property(Popup$, "OLE.Size", Size)	
	Set_Property(Popup$, "OLE.ItemList", Items)
	*Set_Property(Popup$, "OLE.Visible", Yes$)
	Send_Message(Popup$, "OLE.ShowAt", Param2<1>, Param2<2>)
return
