diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2019-07-02 16:18:52 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2019-07-02 16:18:52 +0200 |
commit | c27c94f8945bb3568c0075e0e49207814f6d08fc (patch) | |
tree | 0b0ce2a0bfe8bc9c58e640b6e78ab8ff959de2d3 /wizards | |
parent | 12748b06cbdefd67725009520e4c27bd82cab60f (diff) |
Access2Base - MsgBox and InputBox methods
Convenient functions to be called from Python
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/access2base/Utils.xba | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/wizards/source/access2base/Utils.xba b/wizards/source/access2base/Utils.xba index 56a2e8a85dd3..65221aba3007 100644 --- a/wizards/source/access2base/Utils.xba +++ b/wizards/source/access2base/Utils.xba @@ -872,6 +872,59 @@ Dim lChar As Long, sByte1 As String, sByte2 As String, sByte3 As String End Function ' _PercentEncode V1.4.0 REM ----------------------------------------------------------------------------------------------------------------------- +Public Function _PyInputBox(ByVal pvText As Variant _ + , ByVal pvTitle As Variant _ + , ByVal pvDefault As Variant _ + , ByVal pvXPos As Variant _ + , ByVal pvYPos As Variant _ + ) As Variant +' Convenient function to open input box from Python + + On Local Error GoTo Exit_Function + _PyInputBox = Null + + If Not Utils._CheckArgument(pvText, 1, vbString) Then Goto Exit_Function + If IsEmpty(pvTitle) Then pvTitle = "" + If Not Utils._CheckArgument(pvTitle, 2, vbString) Then Goto Exit_Function + If IsEmpty(pvDefault) Then pvDefault = "" + If Not Utils._CheckArgument(pvDefault, 3, vbString) Then Goto Exit_Function + If IsEmpty(pvXPos) Or IsEmpty(pvYPos) Then + _PyInputBox = InputBox(pvText, pvTitle, pvDefault) + Else + If Not Utils._CheckArgument(pvXPos, 4, Utils._AddNumeric()) Then Goto Exit_Function + If Not Utils._CheckArgument(pvYPos, 5, Utils._AddNumeric()) Then Goto Exit_Function + _PyInputBox = InputBox(pvText, pvTitle, pvDefault, pvXPos, pvYPos) + End If + +Exit_Function: + Exit Function +End Function ' PyInputBox V6.4.0 + +REM ----------------------------------------------------------------------------------------------------------------------- +Public Function _PyMsgBox(ByVal pvText As Variant _ + , ByVal pvType As Variant _ + , ByVal pvDialogTitle As Variant _ + ) As Variant +' Convenient function to open message box from Python + + On Local Error GoTo Exit_Function + _PyMsgBox = Null + + If Not Utils._CheckArgument(pvText, 1, vbString) Then Goto Exit_Function + If IsEmpty(pvType) Then pvType = 0 + If Not Utils._CheckArgument(pvType, 2, Utils._AddNumeric()) Then Goto Exit_Function + If IsEmpty(pvDialogTitle) Then + _PyMsgBox = MsgBox(pvText, pvType) + Else + If Not Utils._CheckArgument(pvDialogTitle, 3, vbString) Then Goto Exit_Function + _PyMsgBox = MsgBox(pvText, pvType, pvDialogTitle) + End If + +Exit_Function: + Exit Function +End Function ' PyMsgBox V6.4.0 + +REM ----------------------------------------------------------------------------------------------------------------------- Public Function _ReadFileIntoArray(ByVal psFileName) As Variant ' Loads all lines of a text file into a variant array ' Any error reduces output to an empty array |