File: u_error_list.sru
Size: 4485
Date: Mon, 07 Apr 2008 21:31:55 +0200
$PBExportHeader$u_error_list.sru
forward
global type u_error_list from u_base_container
end type
type dw_1 from u_dwlv within u_error_list
end type
end forward

global type u_error_list from u_base_container
integer width = 1536
integer height = 192
event ke_alert ( )
dw_1 dw_1
end type
global u_error_list u_error_list

type variables
Protected:
long #NumFlash

private:
CONSTANT string ERROR_NUMBER = "errornumber"
CONSTANT string ERROR_TITLE = "errortitle"
CONSTANT string ERROR_MESSAGE = "errormessage"
CONSTANT string ERROR_SEVERITY = "severity"
CONSTANT string ERROR_IMAGENAME = "imagename"
CONSTANT string ERROR_ALERT = "alert"
CONSTANT string ERROR_IMAGE_PATH = "path"

n_timing inv_timer
boolean ib_show
string PATH = CString.EMPTY
long FLASH_COUNT
end variables

forward prototypes
public subroutine of_reset ()
public subroutine of_addmessage (readonly string as_message)
public subroutine of_addmessage (readonly string as_title, readonly string as_message)
public subroutine of_addmessage (readonly string as_title, readonly string as_message, readonly integer ai_severity)
public subroutine of_alert (readonly boolean ab_alert)
public subroutine of_setpath (readonly string as_path)
public function long of_listcount ()
public function long of_geterrorheight ()
public subroutine of_setnumflash (readonly long al_numflash)
protected subroutine of_showalerticon (readonly boolean ab_show)
end prototypes

event ke_alert();ib_show = NOT ib_show

//check for number of flashes
IF #NumFlash > 0 THEN 
   FLASH_COUNT ++
   IF FLASH_COUNT > (#NumFlash * 2) THEN
      of_Alert(FALSE)
      RETURN
   END IF
END IF

of_ShowAlertIcon(ib_show)
end event

public subroutine of_reset ();dw_1.Reset()
end subroutine

public subroutine of_addmessage (readonly string as_message);of_AddMessage("Information", as_message)
end subroutine

public subroutine of_addmessage (readonly string as_title, readonly string as_message);of_AddMessage(as_title, as_message, 0)
end subroutine

public subroutine of_addmessage (readonly string as_title, readonly string as_message, readonly integer ai_severity);long ll_row

ll_row = dw_1.InsertRow(1)

dw_1.SetItem(ll_row, ERROR_TITLE, as_title)
dw_1.SetItem(ll_row, ERROR_MESSAGE, as_message)
dw_1.SetItem(ll_row, ERROR_SEVERITY, ai_severity)
dw_1.SetItem(ll_row, ERROR_SEVERITY, ai_severity)
dw_1.SetItem(ll_row, ERROR_IMAGE_PATH, PATH)

Beep(1)
end subroutine

public subroutine of_alert (readonly boolean ab_alert);IF ab_alert THEN
   IF NOT ISVALID(inv_timer) THEN &
      inv_timer = CREATE n_timing
   FLASH_COUNT = 0   
   inv_timer.event ke_setparent(this, "ke_alert")
   inv_Timer.Start(0.5)
ELSE
   IF ISVALID(inv_timer) THEN
      inv_timer.Stop()
      DESTROY inv_timer
      of_ShowAlertIcon(TRUE)     
   END IF
END IF
end subroutine

public subroutine of_setpath (readonly string as_path);PATH = as_path
end subroutine

public function long of_listcount ();RETURN dw_1.RowCount()
end function

public function long of_geterrorheight ();long ll_count, n, ll_h

ll_count = dw_1.RowCount()
FOR n = 1 to ll_count
   ll_h += dw_1.GetItemNumber(n, "cf_rowheight")
NEXT

RETURN ll_h + //buffer
end function

public subroutine of_setnumflash (readonly long al_numflash);#NumFlash = al_numflash
FLASH_COUNT = 0
end subroutine

protected subroutine of_showalerticon (readonly boolean ab_show);long ll

IF ab_show THEN
   ll = 1
ELSE
   ll = 0
END IF

long ll_count, n
ll_count = dw_1.RowCount()
FOR n = 1 to ll_count
   dw_1.SetItem(n, ERROR_ALERT, ll)
NEXT
end subroutine

on u_error_list.create
int iCurrent
call super::create
this.dw_1=create dw_1
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.dw_1
end on

on u_error_list.destroy
call super::destroy
destroy(this.dw_1)
end on

event destructor;call super::destructor;of_alert(FALSE)
end event

type dw_1 from u_dwlv within u_error_list
integer width = 1390
integer height = 192
integer taborder = 10
string dataobject = "datawindow_error_list"
boolean hscrollbar = false
boolean border = false
boolean #dock = true
long #docktype = 5
boolean #resizeobjects = true
boolean #validaterequiredfields = false
boolean #standarddropdowndatawindow = false
boolean #dropdownservices = false
boolean #dropdowndatetime = false
boolean #ignoredatetimeerror = false
boolean #rowselection = false
boolean #listviewstyle = false
boolean #sortheaders = false
end type