$PBExportHeader$u_xls_dw.sru FORWARD GLOBAL TYPE u_xls_dw FROM datawindow END TYPE END FORWARD GLOBAL TYPE u_xls_dw FROM datawindow Integer Width = 2176 Integer Height = 1096 Integer TabOrder = 1 EVENT refresh pbm_custom01 EVENT newrow pbm_custom02 EVENT DeleteRow pbm_custom03 EVENT savedata pbm_custom04 EVENT retrievedata pbm_custom05 EVENT AcceptText pbm_custom06 EVENT newfirstrow pbm_custom07 EVENT newlastrow pbm_custom08 EVENT postaccepttext pbm_custom09 EVENT documentation pbm_custom75 EVENT parentresize pbm_custom10 END TYPE GLOBAL u_xls_dw u_xls_dw TYPE VARIABLES PUBLIC: Boolean bFailedAccept = FALSE, i_bFailedSave = FALSE Boolean i_bAutoResizeHorizontal = FALSE, i_bAutoResizeVertical = FALSE Integer i_nBottomGap, i_nRightGap, i_nMinWidth, i_nMaxWidth = -1, i_nMinHeight, i_nMaxHeight = -1 Window i_wParent PRIVATE: Boolean i_bInAcceptText = FALSE END VARIABLES FORWARD PROTOTYPES PUBLIC SUBROUTINE uf_ChangeDataObject (String szdataobject, rowfocusind rfipointertype, picture ptrpointer, Integer nxlocation, Integer nylocation, Transaction trtransaction) PROTECTED FUNCTION Long uf_retrievedata () END PROTOTYPES ON newrow; Long lRow lRow = THIS.GetRow() IF lRow = -1 THEN Error.Object = THIS.ClassName() Error.ObjectEvent = "NewRow" Error.Line = 3 Error.Number = -1 Error.Text = "Error get row information from the datawindow." ELSE lRow = THIS.InsertRow( lRow + 1) IF lRow = -1 THEN Error.Object = THIS.ClassName() Error.ObjectEvent = "NewRow" Error.Line = 12 Error.Number = -1 Error.Text = "Unable to insert a new row into the datawindow." ELSE THIS.SetColumn( 1) THIS.ScrollToRow( lRow) THIS.SetFocus() END IF END IF END ON ON DeleteRow; Long lRow lRow = THIS.GetRow() IF lRow = -1 THEN Error.Object = THIS.ClassName() Error.ObjectEvent = "DeleteRow" Error.Line = 3 Error.Number = -1 Error.Text = "Error get row information from the datawindow." ELSE IF THIS.DeleteRow( lRow) <> 1 THEN Error.Object = THIS.ClassName() Error.ObjectEvent = "DeleteRow" Error.Line = 12 Error.Number = -1 Error.Text = "Unable to Delete a new row into the datawindow." ELSE THIS.ScrollToRow( lRow - 1) THIS.SetFocus() END IF END IF END ON ON AcceptText; IF NOT i_bInAcceptText THEN i_bInAcceptText = TRUE IF THIS.AcceptText() = -1 THEN bFailedAccept = TRUE THIS.SetFocus() THIS.PostEvent( "PostAcceptText") RETURN ELSE bFailedAccept = FALSE END IF END IF i_bInAcceptText = FALSE END ON ON newfirstrow; Long lRow lRow = THIS.InsertRow( 1) IF lRow = -1 THEN Error.Object = THIS.ClassName() Error.ObjectEvent = "NewFirstRow" Error.Line = 3 Error.Number = -1 Error.Text = "Unable to insert a new row into the datawindow." ELSE THIS.SetColumn( 1) THIS.ScrollToRow( lRow) THIS.SetFocus() END IF END ON ON newlastrow; Long lRow lRow = THIS.InsertRow( 0) IF lRow = -1 THEN Error.Object = THIS.ClassName() Error.ObjectEvent = "NewLastRow" Error.Line = 3 Error.Number = -1 Error.Text = "Unable to insert a new row into the datawindow." ELSE THIS.SetColumn( 1) THIS.ScrollToRow( lRow) THIS.SetFocus() END IF END ON ON postaccepttext; i_bInAcceptText = FALSE END ON ON documentation; // Copyright Simon Gallagher 1993-1995 // // This DataWindow object contains the following functionality: // // Events: // DeleteRow - Handles deleting the current row // SaveData - Handles saving the data // RetrieveData - Handles retrieving data for the dw, no parameters // NewRow - Inserts a new row after the current // NewFirstRow - Inserts a new row at the beginning of the dw // NewLastRow - Inserts a new row at the end of the dw // AcceptText - Handles the acceptance of data before focus leaves the window // ParentResize - On direction of a parent window, the datawindow will resize itself END ON ON parentresize; Integer nNewWidth, nNewHeight THIS.SetRedraw( FALSE) IF i_bAutoResizeHorizontal THEN nNewWidth = i_wParent.Width - THIS.X - i_nRightGap IF nNewWidth >= i_nMinWidth And (nNewWidth <= i_nMaxWidth OR i_nMaxWidth = -1) THEN THIS.Width = nNewWidth THIS.HScrollBar = TRUE ELSEIF nNewWidth < i_nMinWidth THEN THIS.Width = i_nMinWidth END IF END IF IF i_bAutoResizeVertical THEN nNewHeight = i_wParent.Height - THIS.Y - i_nBottomGap IF nNewHeight >= i_nMinHeight And (nNewHeight <= i_nMaxHeight OR i_nMaxHeight = -1) THEN THIS.Height = nNewHeight THIS.VScrollBar = TRUE ELSEIF nNewHeight < i_nMinHeight THEN THIS.Height = i_nMinHeight END IF END IF THIS.SetRedraw( TRUE) END ON PUBLIC SUBROUTINE uf_ChangeDataObject (String szdataobject, rowfocusind rfipointertype, picture ptrpointer, Integer nxlocation, Integer nylocation, Transaction trtransaction); THIS.DataObject = szdataobject IF IsValid( ptrpointer) THEN THIS.SetRowFocusIndicator( ptrpointer, nxlocation, nylocation) ELSE THIS.SetRowFocusIndicator( rfipointertype, nxlocation, nylocation) END IF THIS.SetTransObject( trtransaction) END SUBROUTINE PROTECTED FUNCTION Long uf_retrievedata (); RETURN THIS.Retrieve() END FUNCTION EVENT Constructor; IF THIS.SetTransObject( SQLCA) <> 1 THEN Error.Object = THIS.ClassName() Error.ObjectEvent = "Constructor" Error.Line = 1 Error.Number = SQLCA.SQLDBCode Error.Text = SQLCA.SQLErrText END IF END EVENT ON ItemError; i_bInAcceptText = TRUE END ON ON LoseFocus; THIS.PostEvent( "accepttext") END ON EVENT DBError; // Open the standard error window, no values can be passed from this level // any information displayed apart from error text will have to be defined // at the child level Error.Text = SQLErrText Error.Number = SQLDBCode // // Scroll to the row causing the error, if it is in the visible, PRIMARY!, buffer // IF buffer = PRIMARY! THEN THIS.ScrollToRow( row) THIS.SetFocus() END IF // Do Not process message any further RETURN 1 END EVENT ON u_xls_dw.CREATE END ON ON u_xls_dw.DESTROY END ON