[Libreoffice-commits] core.git: wizards/source

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 15 08:58:57 UTC 2021


 wizards/source/sfdocuments/SF_Form.xba |  224 +++++++++++++++++++++++++++++++--
 1 file changed, 217 insertions(+), 7 deletions(-)

New commits:
commit 10d7c694ab2bf3febc3d825a9076463216a23cec
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Thu Jan 14 16:06:08 2021 +0100
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Fri Jan 15 09:58:12 2021 +0100

    ScriptForge - (SF_Form) methods for forms and subforms
    
    MoveFirst, MoveLast, MoveNew, MoveNext, MovePrevious
    Requery
    
    Change-Id: I7d4962e16652c6ef6e0b5400a8b4beae0b15d20b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109298
    Tested-by: Jean-Pierre Ledure <jp at ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <jp at ledure.be>

diff --git a/wizards/source/sfdocuments/SF_Form.xba b/wizards/source/sfdocuments/SF_Form.xba
index 56e60785e40c..9b259034e56d 100644
--- a/wizards/source/sfdocuments/SF_Form.xba
+++ b/wizards/source/sfdocuments/SF_Form.xba
@@ -710,20 +710,195 @@ Public Function Methods() As Variant
 					"Activate" _
 					, "CloseForm" _
 					, "Controls" _
-					, "First" _
 					, "GetDatabase" _
-					, "Last" _
-					, "Move" _
-					, "New" _
-					, "Next" _
-					, "Previous" _
-					, "Refresh" _
+					, "MoveFirst" _
+					, "MoveLast" _
+					, "MoveNew" _
+					, "MoveNext" _
+					, "MovePrevious" _
 					, "Requery" _
 					, "SubForms" _
 					)
 
 End Function	'	SFDocuments.SF_Form.Methods
 
+REM -----------------------------------------------------------------------------
+Public Function MoveFirst() As Boolean
+'''	The cursor is (re)positioned on the first row
+'''	Args:
+'''	Returns:
+'''		True if cursor move is successful
+'''	Example:
+'''			myForm.MoveFirst()
+
+Dim bMoveFirst As Boolean		'	Return value
+Const cstThisSub = "SFDocuments.Form.MoveFirst"
+Const cstSubArgs = ""
+
+	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+	bMoveFirst = False
+
+Check:
+	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+		If Not _IsStillAlive() Then GoTo Finally
+	End If
+Try:
+	With _Form
+		bMoveFirst = .first()
+	End With
+
+Finally:
+	MoveFirst = bMoveFirst
+	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+	Exit Function
+Catch:
+	GoTo Finally
+End Function	'	SFDocuments.SF_Form.MoveFirst
+
+REM -----------------------------------------------------------------------------
+Public Function MoveLast() As Boolean
+'''	The cursor is (re)positioned on the last row
+'''	Args:
+'''	Returns:
+'''		True if cursor move is successful
+'''	Example:
+'''			myForm.MoveLast()
+
+Dim bMoveLast As Boolean		'	Return value
+Const cstThisSub = "SFDocuments.Form.MoveLast"
+Const cstSubArgs = ""
+
+	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+	bMoveLast = False
+
+Check:
+	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+		If Not _IsStillAlive() Then GoTo Finally
+	End If
+Try:
+	With _Form
+		bMoveLast = .last()
+	End With
+
+Finally:
+	MoveLast = bMoveLast
+	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+	Exit Function
+Catch:
+	GoTo Finally
+End Function	'	SFDocuments.SF_Form.MoveLast
+
+REM -----------------------------------------------------------------------------
+Public Function MoveNew() As Boolean
+'''	The cursor is (re)positioned in the new record area
+'''	Args:
+'''	Returns:
+'''		True if cursor move is successful
+'''	Example:
+'''			myForm.MoveNew()
+
+Dim bMoveNew As Boolean		'	Return value
+Const cstThisSub = "SFDocuments.Form.MoveNew"
+Const cstSubArgs = ""
+
+	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+	bMoveNew = False
+
+Check:
+	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+		If Not _IsStillAlive() Then GoTo Finally
+	End If
+Try:
+	With _Form
+		.last()				'	To simulate the behaviour in the UI
+		.moveToInsertRow()
+	End With
+	bMoveNew = True
+
+Finally:
+	MoveNew = bMoveNew
+	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+	Exit Function
+Catch:
+	GoTo Finally
+End Function	'	SFDocuments.SF_Form.MoveNew
+
+REM -----------------------------------------------------------------------------
+Public Function MoveNext(Optional ByVal Offset As Variant) As Boolean
+'''	The cursor is (re)positioned on the next row
+'''	Args:
+'''		Offset: The number of records to go forward (default = 1)
+'''	Returns:
+'''		True if cursor move is successful
+'''	Example:
+'''			myForm.MoveNext()
+
+Dim bMoveNext As Boolean		'	Return value
+Dim lOffset As Long				'	Alias of Offset
+Const cstThisSub = "SFDocuments.Form.MoveNext"
+Const cstSubArgs = ""
+
+	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+	bMoveNext = False
+
+Check:
+	If IsMissing(Offset) Or IsEmpty(Offset) Then Offset = 1
+	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+		If Not _IsStillAlive() Then GoTo Finally
+		If Not ScriptForge.SF_Utils._Validate(Offset, "Offset", ScriptForge.V_NUMERIC) Then GoTo Finally
+	End If
+Try:
+	lOffset = CLng(Offset)		'	To be sure to have the right argument type
+	With _Form
+		If lOffset = 1 Then bMoveNext = .next() Else bMoveNext = .relative(lOffset)
+	End With
+
+Finally:
+	MoveNext = bMoveNext
+	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+	Exit Function
+Catch:
+	GoTo Finally
+End Function	'	SFDocuments.SF_Form.MoveNext
+
+REM -----------------------------------------------------------------------------
+Public Function MovePrevious(Optional ByVal Offset As Variant) As Boolean
+'''	The cursor is (re)positioned on the previous row
+'''	Args:
+'''		Offset: The number of records to go forward (default = 1)
+'''	Returns:
+'''		True if cursor move is successful
+'''	Example:
+'''			myForm.MovePrevious()
+
+Dim bMovePrevious As Boolean		'	Return value
+Dim lOffset As Long				'	Alias of Offset
+Const cstThisSub = "SFDocuments.Form.MovePrevious"
+Const cstSubArgs = ""
+
+	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+	bMovePrevious = False
+
+Check:
+	If IsMissing(Offset) Or IsEmpty(Offset) Then Offset = 1
+	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+		If Not _IsStillAlive() Then GoTo Finally
+		If Not ScriptForge.SF_Utils._Validate(Offset, "Offset", ScriptForge.V_NUMERIC) Then GoTo Finally
+	End If
+Try:
+	lOffset = CLng(Offset)		'	To be sure to have the right argument type
+	With _Form
+		If lOffset = 1 Then bMovePrevious = .previous() Else bMovePrevious = .relative(-lOffset)
+	End With
+
+Finally:
+	MovePrevious = bMovePrevious
+	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+	Exit Function
+Catch:
+	GoTo Finally
+End Function	'	SFDocuments.SF_Form.MovePrevious
+
 REM -----------------------------------------------------------------------------
 Public Function Properties() As Variant
 '''	Return the list or properties of the Form class as an array
@@ -761,6 +936,41 @@ Public Function Properties() As Variant
 
 End Function	'	SFDocuments.SF_Form.Properties
 
+REM -----------------------------------------------------------------------------
+Public Function Requery() As Boolean
+'''	Reload from the database the actual data into the form
+'''	The cursor is (re)positioned on the first row
+'''	Args:
+'''	Returns:
+'''		True if requery is successful
+'''	Example:
+'''			myForm.Requery()
+
+Dim bRequery As Boolean		'	Return value
+Const cstThisSub = "SFDocuments.Form.Requery"
+Const cstSubArgs = ""
+
+	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
+	bRequery = False
+
+Check:
+	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
+		If Not _IsStillAlive() Then GoTo Finally
+	End If
+Try:
+	With _Form
+		If .isLoaded() Then .reload() Else .load()
+	End With
+	bRequery = True
+
+Finally:
+	Requery = bRequery
+	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
+	Exit Function
+Catch:
+	GoTo Finally
+End Function	'	SFDocuments.SF_Form.Requery
+
 REM -----------------------------------------------------------------------------
 Public Function SetProperty(Optional ByVal PropertyName As Variant _
 								, Optional ByRef Value As Variant _


More information about the Libreoffice-commits mailing list