$PBExportHeader$n_sharedobject.sru $PBExportComments$Base shared object forward global type n_sharedobject from nonvisualobject end type end forward global type n_sharedobject from nonvisualobject end type global n_sharedobject n_sharedobject type prototypes end prototypes type variables PowerObject ipo_callback Boolean ib_StopProcess Integer ii_MessageEvent Integer ii_CompleteEvent Integer ii_ProgressEvent Long il_handle end variables forward prototypes public subroutine of_stopprocess () public subroutine of_stopprocess () public function boolean of_stoprequested () public subroutine of_sendprogress (long al_current, long al_maximum) public subroutine of_sendcomplete () public subroutine of_sendstopped () public subroutine of_sendmessage (string as_msgtext) public subroutine of_sendmessage (string as_msgtext, long al_param) public subroutine of_copytrans (ref transaction atr_sqlca) public subroutine of_senderrorstop (string as_msgtext) public subroutine of_registerevents (ref powerobject apo_callback, integer ai_message, integer ai_complete, integer ai_progress) end prototypes public subroutine of_stopprocess ();// ----------------------------------------------------------------------------- // SCRIPT: of_StopProcess // // PURPOSE: This function sets the stop process flag. // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- ib_StopProcess = True end subroutine public function boolean of_stoprequested ();// ----------------------------------------------------------------------------- // SCRIPT: n_sharedobj.of_StopRequested // // PURPOSE: This function returns the stop process flag. // // RETURN: True = On, False = Off // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- Yield() If ib_StopProcess Then of_SendStopped() End If Return ib_StopProcess end function public subroutine of_sendprogress (long al_current, long al_maximum);// ----------------------------------------------------------------------------- // SCRIPT: of_SendProgress // // PURPOSE: This function sends progress event to the registered object. // // ARGUMENTS: al_current - The current processing step // al_maximum - The maximum number of steps // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- If ii_ProgressEvent > 0 Then Send(il_handle, ii_ProgressEvent, al_current, al_maximum) End If end subroutine public subroutine of_sendcomplete ();// ----------------------------------------------------------------------------- // SCRIPT: of_SendComplete // // PURPOSE: This function sends complete event to the registered object. // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- If ii_CompleteEvent > 0 Then Send(il_handle, ii_CompleteEvent, 0, 0) End If end subroutine public subroutine of_sendstopped ();// ----------------------------------------------------------------------------- // SCRIPT: of_SendStopped // // PURPOSE: This function sends complete event to the registered object // passing '1' to indicate stopping due to stop request. // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- If ii_CompleteEvent > 0 Then Send(il_handle, ii_CompleteEvent, 0, 1) End If end subroutine public subroutine of_sendmessage (string as_msgtext);// ----------------------------------------------------------------------------- // SCRIPT: of_SendMessage // // PURPOSE: This function sends a string to the registered object. // // ARGUMENTS: as_msgtext - String to send - received in wparam // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- of_SendMessage(as_msgtext, 0) end subroutine public subroutine of_sendmessage (string as_msgtext, long al_param);// ----------------------------------------------------------------------------- // SCRIPT: of_SendMessage // // PURPOSE: This function sends a string to the registered object. // // ARGUMENTS: as_msgtext - String to send - received in wparam // al_param - Long value - received in lparam // // NOTE: A number passed in al_param could be used to indicate what the // event should do with the string. It could be a message to // display, data to import into a DataWindow, or a status code. // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- If ii_MessageEvent > 0 Then Send(il_handle, ii_MessageEvent, al_param, as_msgtext) End If end subroutine public subroutine of_copytrans (ref transaction atr_sqlca);// ----------------------------------------------------------------------------- // SCRIPT: of_CopyTrans // // PURPOSE: This function copies transaction object properties. // // ARGUMENTS: atr_sqlca - Transaction to copy properties from // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- sqlca.AutoCommit = atr_sqlca.AutoCommit sqlca.Database = atr_sqlca.Database sqlca.DBMS = atr_sqlca.DBMS sqlca.DBParm = atr_sqlca.DBParm sqlca.DBPass = atr_sqlca.DBPass sqlca.Lock = atr_sqlca.Lock sqlca.LogId = atr_sqlca.LogId sqlca.LogPass = atr_sqlca.LogPass sqlca.ServerName = atr_sqlca.ServerName sqlca.Userid = atr_sqlca.Userid end subroutine public subroutine of_senderrorstop (string as_msgtext);// ----------------------------------------------------------------------------- // SCRIPT: of_SendErrorStop // // PURPOSE: This function sends complete event to the registered object // passing '2' to indicate stopping due to errors. // // ARGUMENTS: as_msgtext - String to send - received in wparam // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- If ii_CompleteEvent > 0 Then Send(il_handle, ii_CompleteEvent, 2, as_msgtext) End If end subroutine public subroutine of_registerevents (ref powerobject apo_callback, integer ai_message, integer ai_complete, integer ai_progress);// ----------------------------------------------------------------------------- // SCRIPT: of_RegisterEvents // // PURPOSE: This function saves pointers for sending messages. // // ARGUMENTS: apo_callback - Object that will receive the messages // ai_Message - pbm_customxx event to receive string messages // ai_Complete - pbm_customxx event to receive complete notice // ai_Progress - pbm_customxx event to receive progress notice // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 11/15/2017 RolandS Initial coding // ----------------------------------------------------------------------------- Constant Integer WM_USER = 1024 // save object reference and handle ipo_callback = apo_callback il_handle = Handle(apo_callback) ii_MessageEvent = WM_USER + (ai_Message - 1) ii_CompleteEvent = WM_USER + (ai_Complete - 1) ii_ProgressEvent = WM_USER + (ai_Progress - 1) ib_StopProcess = False end subroutine on n_sharedobject.create call super::create TriggerEvent( this, "constructor" ) end on on n_sharedobject.destroy TriggerEvent( this, "destructor" ) call super::destroy end on
- Sources
- TopWiz
- sharedobjects
- PB
- n_sharedobject.sru
File: n_sharedobject.sru
Size: 8964
Date: Mon, 31 Dec 2018 21:14:39 +0100
Size: 8964
Date: Mon, 31 Dec 2018 21:14:39 +0100
- nonvisualobject n_sharedobject(sru)
- of_copytrans (ref transaction atr_sqlca)
- of_registerevents (ref powerobject apo_callback, integer ai_message, integer ai_complete, integer ai_progress)
- of_sendcomplete ()
- of_senderrorstop (string as_msgtext)
- of_sendmessage (string as_msgtext)
- of_sendmessage (string as_msgtext, long al_param)
- of_sendprogress (long al_current, long al_maximum)
- of_sendstopped ()
- of_stopprocess ()
- of_stoprequested () returns boolean