From 076084a71758fcdc2eca6099d3ec8bd262e7e46b Mon Sep 17 00:00:00 2001 From: Jean-Pierre Ledure Date: Wed, 30 Nov 2016 12:22:34 +0100 Subject: Access2Base - Implement On ... event properties Event properties applied to form, subform, control events Controls may belong to forms, subforms, dialogs, grid controls Change-Id: Iaf33adcd03527ac938913675cf0930e317a17f97 --- wizards/source/access2base/Collect.xba | 4 +- wizards/source/access2base/Compatible.xba | 4 +- wizards/source/access2base/Control.xba | 402 ++++++++++++++++++++++++----- wizards/source/access2base/Form.xba | 192 +++++++++++++- wizards/source/access2base/Root_.xba | 2 + wizards/source/access2base/SubForm.xba | 189 +++++++++++++- wizards/source/access2base/Utils.xba | 95 +++++++ wizards/source/access2base/acConstants.xba | 2 +- 8 files changed, 813 insertions(+), 77 deletions(-) diff --git a/wizards/source/access2base/Collect.xba b/wizards/source/access2base/Collect.xba index 74cd756c00f2..ad33cc77a810 100644 --- a/wizards/source/access2base/Collect.xba +++ b/wizards/source/access2base/Collect.xba @@ -105,8 +105,10 @@ Dim vNames() As Variant, oProperty As Object End Select Case COLLPROPERTIES Select Case _ParentType - Case OBJCONTROL, OBJSUBFORM + Case OBJCONTROL Set Item = getObject(_ParentName).Properties(pvItem) + Case OBJSUBFORM + Set Item = getValue(_ParentName).Properties(pvItem) Case OBJDATABASE Set Item = _ParentDatabase.Properties(pvItem) Case OBJDIALOG diff --git a/wizards/source/access2base/Compatible.xba b/wizards/source/access2base/Compatible.xba index 30cab096180f..92012b56a420 100644 --- a/wizards/source/access2base/Compatible.xba +++ b/wizards/source/access2base/Compatible.xba @@ -19,7 +19,7 @@ Dim vVarTypes() As Variant, i As Integer Const cstTab = 5 On Local Error Goto Exit_Sub ' Never interrupt processing Utils._SetCalledSub("DebugPrint") - vVarTypes = Utils._AddNumeric(Array(vbEmpty, vbNull, vbDate, vbString, vbBoolean, vbObject, vbVariant, vbByte, 8192 + vbByte)) + vVarTypes = Utils._AddNumeric(Array(vbEmpty, vbNull, vbDate, vbString, vbBoolean, vbObject, vbVariant, vbByte, vbArray + vbByte)) If UBound(pvArgs) >= 0 Then For i = 0 To UBound(pvArgs) @@ -34,7 +34,7 @@ Const cstTab = 5 Dim sOutput As String, sArg As String sOutput = "" For i = 0 To UBound(pvArgs) - sArg = Utils._CStr(pvArgs(i)) + sArg = Utils._CStr(pvArgs(i), _A2B_.DebugPrintShort) ' Add argument to output If i = 0 Then sOutput = sArg diff --git a/wizards/source/access2base/Control.xba b/wizards/source/access2base/Control.xba index 040a1817edfb..f02b46cca644 100644 --- a/wizards/source/access2base/Control.xba +++ b/wizards/source/access2base/Control.xba @@ -26,7 +26,7 @@ Private _DbEntry As Integer Private _ControlType As Integer Private _SubType As String Private ControlModel As Object ' com.sun.star.comp.forms.XXXModel -Private ControlView As Object ' com.sun.star.comp.forms.XXXControl +Private ControlView As Object ' com.sun.star.comp.forms.XXXControl (NULL if form open in edit mode) Private BoundField As Object ' com.sun.star.sdb.ODataColumn Private LabelControl As Object ' com.sun.star.form.component.FixedText or com.sun.star.form.component.GroupBox @@ -283,6 +283,195 @@ Property Get ObjectType() As String ObjectType = _PropertyGet("ObjectType") End Property ' ObjectType (get) +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnActionPerformed() As Variant + OnActionPerformed = _PropertyGet("OnActionPerformed") +End Property ' OnActionPerformed (get) + +Property Let OnActionPerformed(ByVal pvValue As Variant) + Call _PropertySet("OnActionPerformed", pvValue) +End Property ' OnActionPerformed (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnAdjustmentValueChanged() As Variant + OnAdjustmentValueChanged = _PropertyGet("OnAdjustmentValueChanged") +End Property ' OnAdjustmentValueChanged (get) + +Property Let OnAdjustmentValueChanged(ByVal pvValue As Variant) + Call _PropertySet("OnAdjustmentValueChanged", pvValue) +End Property ' OnAdjustmentValueChanged (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveAction() As Variant + OnApproveAction = _PropertyGet("OnApproveAction") +End Property ' OnApproveAction (get) + +Property Let OnApproveAction(ByVal pvValue As Variant) + Call _PropertySet("OnApproveAction", pvValue) +End Property ' OnApproveAction (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveReset() As Variant + OnApproveReset = _PropertyGet("OnApproveReset") +End Property ' OnApproveReset (get) + +Property Let OnApproveReset(ByVal pvValue As Variant) + Call _PropertySet("OnApproveReset", pvValue) +End Property ' OnApproveReset (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveUpdate() As Variant + OnApproveUpdate = _PropertyGet("OnApproveUpdate") +End Property ' OnApproveUpdate (get) + +Property Let OnApproveUpdate(ByVal pvValue As Variant) + Call _PropertySet("OnApproveUpdate", pvValue) +End Property ' OnApproveUpdate (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnChanged() As Variant + OnChanged = _PropertyGet("OnChanged") +End Property ' OnChanged (get) + +Property Let OnChanged(ByVal pvValue As Variant) + Call _PropertySet("OnChanged", pvValue) +End Property ' OnChanged (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnErrorOccurred() As Variant + OnErrorOccurred = _PropertyGet("OnErrorOccurred") +End Property ' OnErrorOccurred (get) + +Property Let OnErrorOccurred(ByVal pvValue As Variant) + Call _PropertySet("OnErrorOccurred", pvValue) +End Property ' OnErrorOccurred (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnFocusGained() As Variant + OnFocusGained = _PropertyGet("OnFocusGained") +End Property ' OnFocusGained (get) + +Property Let OnFocusGained(ByVal pvValue As Variant) + Call _PropertySet("OnFocusGained", pvValue) +End Property ' OnFocusGained (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnFocusLost() As Variant + OnFocusLost = _PropertyGet("OnFocusLost") +End Property ' OnFocusLost (get) + +Property Let OnFocusLost(ByVal pvValue As Variant) + Call _PropertySet("OnFocusLost", pvValue) +End Property ' OnFocusLost (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnItemStateChanged() As Variant + OnItemStateChanged = _PropertyGet("OnItemStateChanged") +End Property ' OnItemStateChanged (get) + +Property Let OnItemStateChanged(ByVal pvValue As Variant) + Call _PropertySet("OnItemStateChanged", pvValue) +End Property ' OnItemStateChanged (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnKeyPressed() As Variant + OnKeyPressed = _PropertyGet("OnKeyPressed") +End Property ' OnKeyPressed (get) + +Property Let OnKeyPressed(ByVal pvValue As Variant) + Call _PropertySet("OnKeyPressed", pvValue) +End Property ' OnKeyPressed (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnKeyReleased() As Variant + OnKeyReleased = _PropertyGet("OnKeyReleased") +End Property ' OnKeyReleased (get) + +Property Let OnKeyReleased(ByVal pvValue As Variant) + Call _PropertySet("OnKeyReleased", pvValue) +End Property ' OnKeyReleased (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnMouseDragged() As Variant + OnMouseDragged = _PropertyGet("OnMouseDragged") +End Property ' OnMouseDragged (get) + +Property Let OnMouseDragged(ByVal pvValue As Variant) + Call _PropertySet("OnMouseDragged", pvValue) +End Property ' OnMouseDragged (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnMouseEntered() As Variant + OnMouseEntered = _PropertyGet("OnMouseEntered") +End Property ' OnMouseEntered (get) + +Property Let OnMouseEntered(ByVal pvValue As Variant) + Call _PropertySet("OnMouseEntered", pvValue) +End Property ' OnMouseEntered (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnMouseExited() As Variant + OnMouseExited = _PropertyGet("OnMouseExited") +End Property ' OnMouseExited (get) + +Property Let OnMouseExited(ByVal pvValue As Variant) + Call _PropertySet("OnMouseExited", pvValue) +End Property ' OnMouseExited (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnMouseMoved() As Variant + OnMouseMoved = _PropertyGet("OnMouseMoved") +End Property ' OnMouseMoved (get) + +Property Let OnMouseMoved(ByVal pvValue As Variant) + Call _PropertySet("OnMouseMoved", pvValue) +End Property ' OnMouseMoved (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnMousePressed() As Variant + OnMousePressed = _PropertyGet("OnMousePressed") +End Property ' OnMousePressed (get) + +Property Let OnMousePressed(ByVal pvValue As Variant) + Call _PropertySet("OnMousePressed", pvValue) +End Property ' OnMousePressed (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnMouseReleased() As Variant + OnMouseReleased = _PropertyGet("OnMouseReleased") +End Property ' OnMouseReleased (get) + +Property Let OnMouseReleased(ByVal pvValue As Variant) + Call _PropertySet("OnMouseReleased", pvValue) +End Property ' OnMouseReleased (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnResetted() As Variant + OnResetted = _PropertyGet("OnResetted") +End Property ' OnResetted (get) + +Property Let OnResetted(ByVal pvValue As Variant) + Call _PropertySet("OnResetted", pvValue) +End Property ' OnResetted (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnTextChanged() As Variant + OnTextChanged = _PropertyGet("OnTextChanged") +End Property ' OnTextChanged (get) + +Property Let OnTextChanged(ByVal pvValue As Variant) + Call _PropertySet("OnTextChanged", pvValue) +End Property ' OnTextChanged (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnUpdated() As Variant + OnUpdated = _PropertyGet("OnUpdated") +End Property ' OnUpdated (get) + +Property Let OnUpdated(ByVal pvValue As Variant) + Call _PropertySet("OnUpdated", pvValue) +End Property ' OnUpdated (set) + REM ----------------------------------------------------------------------------------------------------------------------- Property Get OptionValue() As Variant OptionValue = _PropertyGet("OptionValue") @@ -557,8 +746,9 @@ REM ---------------------------------------------------------------------------- Public Function Controls(Optional ByVal pvIndex As Variant) As Variant ' Return a Control object with name or index = pvIndex +Const cstThisSub = "Control.Controls" If _ErrorHandler() Then On Local Error Goto Error_Function - Utils._SetCalledSub("Grid.Controls") + Utils._SetCalledSub(cstThisSub) Dim ocControl As Variant, sParentShortcut As String, iControlCount As Integer Dim oCounter As Variant, sControls() As Variant, i As Integer, bFound As Boolean, sIndex As String @@ -609,13 +799,17 @@ Dim j As Integer, oView As Object ocControl._FormComponent = ParentComponent If Utils._hasUNOProperty(ocControl.ControlModel, "ClassId") Then ocControl._ClassId = ocControl.ControlModel.ClassId ' Complex bypass to find View of grid subcontrols ! - For i = 0 to ControlView.getCount() - 1 - Set oView = ControlView.GetByIndex(i) - If oView.getModel.Name = ocControl._Name Then - Set ocControl.ControlView = oView - Exit For - End If - Next i + If Not IsNull(ControlView) Then ' Anticipate absence of ControlView in grid controls when edit mode + For i = 0 to ControlView.getCount() - 1 + Set oView = ControlView.GetByIndex(i) + If Not IsNull(oView) Then + If oView.getModel.Name = ocControl._Name Then + Set ocControl.ControlView = oView + Exit For + End If + End If + Next i + End If ocControl._Initialize() ocControl._DocEntry = _DocEntry @@ -623,7 +817,7 @@ Dim j As Integer, oView As Object Set Controls = ocControl Exit_Function: - Utils._ResetCalledSub("Grid.Controls") + Utils._ResetCalledSub(cstThisSub) Exit Function Trace_Error_Index: TraceError(TRACEFATAL, ERRCOLLECTION, Utils._CalledSub(), 0, 1) @@ -638,7 +832,7 @@ Trace_Error_Context: Set Controls = Nothing Goto Exit_Function Error_Function: - TraceError(TRACEABORT, Err, "Grid.Controls", Erl) + TraceError(TRACEABORT, Err, cstThisSub, Erl) Set Controls = Nothing GoTo Exit_Function End Function ' Controls @@ -787,6 +981,8 @@ Public Function setFocus() As Boolean Dim i As Integer, j As Integer, iColPosition As Integer Dim ocControl As Object, ocGrid As Variant, oGridModel As Object + + If IsNull(ControlView) Then GoTo Exit_Function If _ParentType = CTLPARENTISGRID Then 'setFocus method does not work on controlviews in grid ?!? ' Find column position of control iColPosition = -1 @@ -873,6 +1069,41 @@ Dim vFormats() As Variant End Function ' _Formats V0.9.1 +REM ----------------------------------------------------------------------------------------------------------------------- +Private Function _GetListener(ByVal psProperty As String) As String +' Return the X...Listener corresponding with the property in argument + + Select Case UCase(psProperty) + Case UCase("OnActionPerformed") + _GetListener = "XActionListener" + Case UCase("OnAdjustmentValueChanged") + _GetListener = "XAdjustmentListener" + Case UCase("OnApproveAction") + _GetListener = "XApproveActionListener" + Case UCase("OnApproveReset"), UCase("OnResetted") + _GetListener = "XResetListener" + Case UCase("OnApproveUpdate"), UCase("OnUpdated") + _GetListener = "XUpdateListener" + Case UCase("OnChanged") + _GetListener = "XChangeListener" + Case UCase("OnErrorOccurred") + _GetListener = "XErrorListener" + Case UCase("OnFocusGained"), UCase("OnFocusLost") + _GetListener = "XFocusListener" + Case UCase("OnItemStateChanged") + _GetListener = "XItemListener" + Case UCase("OnKeyPressed"), UCase("OnKeyReleased") + _GetListener = "XKeyListener" + Case UCase("OnMouseDragged"), UCase("OnMouseMoved") + _GetListener = "XMouseMotionListener" + Case UCase("OnMouseEntered"), UCase("OnMouseExited"), UCase("OnMousePressed"), UCase("OnMouseReleased") + _GetListener = "XMouseListener" + Case UCase("OnTextChanged") + _GetListener = "XTextListener" + End Select + +End Function ' _GetListener V1.7.0 + REM ----------------------------------------------------------------------------------------------------------------------- Public Sub _Initialize() ' Initialize new Control @@ -1024,6 +1255,27 @@ Dim vFullPropertiesList() As Variant , "MultiSelect" _ , "Name" _ , "ObjectType" _ + , "OnActionPerformed" _ + , "OnAdjustmentValueChanged" _ + , "OnApproveAction" _ + , "OnApproveReset" _ + , "OnApproveUpdate" _ + , "OnChanged" _ + , "OnErrorOccurred" _ + , "OnFocusGained" _ + , "OnFocusLost" _ + , "OnItemStateChanged" _ + , "OnKeyPressed" _ + , "OnKeyReleased" _ + , "OnMouseDragged" _ + , "OnMouseEntered" _ + , "OnMouseExited" _ + , "OnMouseMoved" _ + , "OnMousePressed" _ + , "OnMouseReleased" _ + , "OnResetted" _ + , "OnTextChanged" _ + , "OnUpdated" _ , "OptionValue" _ , "Page" _ , "Parent" _ @@ -1049,65 +1301,64 @@ Dim vFullPropertiesList() As Variant Dim vPropertiesMatrix(25) As Variant Select Case _ParentType Case CTLPARENTISFORM, CTLPARENTISSUBFORM - vPropertiesMatrix(acCheckBox) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,31,33,40,41,42,43,44,46,47,48,49) - vPropertiesMatrix(acComboBox) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,20,23,24,25,27,28,31,33,34,35,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acCommandButton) = Array(0,3,4,6,7,8,10,11,12,13,14,15,16,17,27,28,31,41,42,43,44,46,48,49) - vPropertiesMatrix(acCurrencyField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,31,33,41,42,43,44,46,48,49) - vPropertiesMatrix(acDateField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,31,33,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acFileControl) = Array(0,1,2,6,7,9,10,11,12,13,14,15,16,17,25,27,28,31,41,42,43,44,45,48,49) - vPropertiesMatrix(acFixedLine) = Array() - vPropertiesMatrix(acFixedText) = Array(0,1,2,4,6,7,10,11,12,13,14,15,16,17,27,28,31,41,44,46,49) - vPropertiesMatrix(acFormattedField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,31,33,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acGridControl) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,27,28,31,41,42,43,44,49) - vPropertiesMatrix(acGroupBox) = Array(4,6,7,10,11,12,13,14,15,16,17,27,28,31,41,44,49) - vPropertiesMatrix(acHiddenControl) = Array(7,27,28,31,41,44,48,49) - vPropertiesMatrix(acImageButton) = Array(0,1,2,6,7,10,27,28,31,32,41,42,43,44,49) - vPropertiesMatrix(acImageControl) = Array(0,1,2,5,6,7,10,25,27,28,31,32,33,41,42,43,44,49) - vPropertiesMatrix(acListBox) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,20,23,24,25,26,27,28,31,33,34,35,36,41,42,43,44,46,48,49) - vPropertiesMatrix(acNavigationBar) = Array(0,2,6,7,10,11,12,13,14,15,16,17,27,28,31,41,42,43,44,49) - vPropertiesMatrix(acNumericField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,31,33,41,42,43,44,46,48,49) - vPropertiesMatrix(acPatternField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,31,33,37,38,39,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acProgressBar) = Array() - vPropertiesMatrix(acRadioButton) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,31,33,40,41,42,43,44,46,48,49) - vPropertiesMatrix(acScrollBar) = Array(0,1,2,6,7,10,27,28,31,41,42,43,44,48,49) - vPropertiesMatrix(acSpinButton) = Array(0,1,2,6,7,9,10,27,28,31,41,42,43,44,48,49) - vPropertiesMatrix(0) = Array(7,18,21,22,27,28,31,41) - vPropertiesMatrix(acTextField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,31,33,37,38,39,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acTimeField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,31,33,41,42,43,44,45,46,48,49) + vPropertiesMatrix(acCheckBox) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,52,54,61,62,63,64,65,67,68,69,70) + vPropertiesMatrix(acComboBox) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,20,23,24,25,27,28,29,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,52,54,55,56,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acCommandButton) = Array(0,3,4,6,7,8,10,11,12,13,14,15,16,17,27,28,29,31,32,36,37,38,39,40,41,42,43,44,45,46,47,52,53,62,63,64,65,67,69,70) + vPropertiesMatrix(acCurrencyField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,67,69,70) + vPropertiesMatrix(acDateField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acFileControl) = Array(0,1,2,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,36,37,39,40,41,42,43,44,45,46,47,48,52,62,63,64,65,66,69,70) + vPropertiesMatrix(acFixedText) = Array(0,1,2,4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,52,62,65,67,70) + vPropertiesMatrix(acFormattedField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,32,33,35,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acGridControl) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,27,28,32,33,35,36,37,39,40,41,42,43,44,45,46,47,49,52,62,63,64,65,70) + vPropertiesMatrix(acGroupBox) = Array(4,6,7,10,11,12,13,14,15,16,17,27,28,32,36,37,39,40,41,42,43,44,45,46,47,52,62,65,70) + vPropertiesMatrix(acHiddenControl) = Array(7,27,28,52,62,65,69,70) + vPropertiesMatrix(acImageButton) = Array(0,1,2,6,7,10,27,28,31,36,37,39,40,41,42,43,44,45,46,52,53,62,63,64,65,70) + vPropertiesMatrix(acImageControl) = Array(0,1,2,5,6,7,10,25,27,28,32,36,37,39,40,41,42,43,44,45,46,47,52,53,54,62,63,64,65,70) + vPropertiesMatrix(acListBox) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,20,23,24,25,26,27,28,29,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,49,52,54,55,56,57,62,63,64,65,67,69,70) + vPropertiesMatrix(acNavigationBar) = Array(0,2,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,52,62,63,64,65,70) + vPropertiesMatrix(acNumericField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,67,69,70) + vPropertiesMatrix(acPatternField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acRadioButton) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,50,52,54,61,62,63,64,65,67,69,70) + vPropertiesMatrix(acScrollBar) = Array(0,1,2,6,7,10,27,28,30,32,33,36,37,39,40,41,42,43,44,45,46,47,49,52,62,63,64,65,69,70) + vPropertiesMatrix(acSpinButton) = Array(0,1,2,6,7,9,10,27,28,30,32,33,36,37,39,40,41,42,43,44,45,46,47,49,52,62,63,64,65,69,70) + vPropertiesMatrix(0) = Array(7,18,21,22,27,28,52,62) + vPropertiesMatrix(acTextField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,25,27,28,32,33,34,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acTimeField) = Array(0,1,2,5,6,7,9,10,11,12,13,14,15,16,17,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,63,64,65,66,67,69,70) Case CTLPARENTISGROUP ' To be duplicated from above !!! - vPropertiesMatrix(acRadioButton) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,31,33,40,41,42,43,44,46,48,49) + vPropertiesMatrix(acRadioButton) = Array(0,4,5,6,7,9,10,11,12,13,14,15,16,17,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,50,52,54,61,62,63,64,65,67,69,70) Case CTLPARENTISGRID - vPropertiesMatrix(acCheckBox) = Array(4,5,6,7,9,10,27,28,31,33,40,41,44,46,47,48) - vPropertiesMatrix(acComboBox) = Array(4,5,6,7,9,10,20,23,24,25,27,28,31,33,34,35,41,44,45,46,48) - vPropertiesMatrix(acCurrencyField) = Array(4,5,6,7,9,10,25,27,28,31,33,41,44,46,48) - vPropertiesMatrix(acDateField) = Array(4,5,6,7,9,10,19,25,27,28,31,33,41,44,45,46,48) - vPropertiesMatrix(acFormattedField) = Array(4,5,6,7,9,10,19,25,27,28,31,33,41,44,45,46,48) - vPropertiesMatrix(acListBox) = Array(4,5,6,7,9,10,20,23,24,25,26,27,28,31,33,34,35,36,41,44,46,48) - vPropertiesMatrix(acNumericField) = Array(4,5,6,7,9,10,25,27,28,31,33,41,44,46,48) - vPropertiesMatrix(acPatternField) = Array(4,5,6,7,9,10,25,27,28,31,33,37,38,39,41,44,45,46,48) - vPropertiesMatrix(acTextField) = Array(4,5,6,7,9,10,25,27,28,31,33,37,38,39,41,44,45,46,48) - vPropertiesMatrix(acTimeField) = Array(4,5,6,7,9,10,19,25,27,28,31,33,41,44,45,46,48) + vPropertiesMatrix(acCheckBox) = Array(4,5,6,7,9,10,27,28,29,32,36,37,38,39,40,41,42,43,44,45,46,47,52,54,61,62,65,67,68,69) + vPropertiesMatrix(acComboBox) = Array(4,5,6,7,9,10,20,23,24,25,27,28,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,52,54,55,56,62,65,66,67,69) + vPropertiesMatrix(acCurrencyField) = Array(4,5,6,7,9,10,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,67,69) + vPropertiesMatrix(acDateField) = Array(4,5,6,7,9,10,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,66,67,69) + vPropertiesMatrix(acFormattedField) = Array(4,5,6,7,9,10,19,25,27,28,32,33,35,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,66,67,69) + vPropertiesMatrix(acListBox) = Array(4,5,6,7,9,10,20,23,24,25,26,27,28,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,49,52,54,55,56,57,62,65,67,69) + vPropertiesMatrix(acNumericField) = Array(4,5,6,7,9,10,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,67,69) + vPropertiesMatrix(acPatternField) = Array(4,5,6,7,9,10,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,65,66,67,69) + vPropertiesMatrix(acTextField) = Array(4,5,6,7,9,10,25,27,28,32,33,34,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,58,59,60,62,65,66,67,69) + vPropertiesMatrix(acTimeField) = Array(4,5,6,7,9,10,19,25,27,28,32,33,36,37,39,40,41,42,43,44,45,46,47,48,49,52,54,62,65,66,67,69) Case CTLPARENTISDIALOG - vPropertiesMatrix(acCheckBox) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,30,31,40,41,42,43,44,46,47,48,49) - vPropertiesMatrix(acComboBox) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,20,23,24,25,27,28,30,31,34,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acCommandButton) = Array(0,3,4,6,7,8,10,11,12,13,14,15,16,17,27,28,30,31,41,42,43,44,46,49) - vPropertiesMatrix(acCurrencyField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,30,31,41,42,43,44,46,48,49) - vPropertiesMatrix(acDateField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,30,31,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acFileControl) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,30,31,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acFixedLine) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,30,31,41,42,44,49) - vPropertiesMatrix(acFixedText) = Array(0,1,2,4,6,7,10,11,12,13,14,15,16,17,27,28,30,31,41,42,43,44,46,49) - vPropertiesMatrix(acFormattedField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,30,31,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acGroupBox) = Array(4,6,7,10,11,12,13,14,15,16,17,27,28,30,31,41,42,44,49) - vPropertiesMatrix(acImageControl) = Array(0,1,2,6,7,10,27,28,30,31,41,42,43,44,49) - vPropertiesMatrix(acListBox) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,20,23,24,25,26,27,28,30,31,34,36,41,42,43,44,46,48,49) - vPropertiesMatrix(acNumericField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,30,31,41,42,43,44,46,48,49) - vPropertiesMatrix(acPatternField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,30,31,37,38,39,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acProgressBar) = Array(0,1,2,6,7,10,27,28,30,31,41,42,44,48,49) - vPropertiesMatrix(acRadioButton) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,29,30,31,40,41,42,43,44,46,48,49) - vPropertiesMatrix(acScrollBar) = Array(0,1,2,6,7,10,27,28,30,31,41,42,43,44,48,49) - vPropertiesMatrix(acTextField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,30,31,37,38,39,41,42,43,44,45,46,48,49) - vPropertiesMatrix(acTimeField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,30,31,41,42,43,44,45,46,48,49) + vPropertiesMatrix(acCheckBox) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,29,36,37,38,39,40,41,42,43,44,45,46,51,52,61,62,63,64,65,67,68,69,70) + vPropertiesMatrix(acComboBox) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,20,23,24,25,27,28,29,36,37,38,39,40,41,42,43,44,45,46,48,51,52,55,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acCommandButton) = Array(0,3,4,6,7,8,10,11,12,13,14,15,16,17,27,28,29,36,37,38,39,40,41,42,43,44,45,46,51,52,53,62,63,64,65,67,70) + vPropertiesMatrix(acCurrencyField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,67,69,70) + vPropertiesMatrix(acDateField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acFileControl) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acFixedLine) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,65,70) + vPropertiesMatrix(acFixedText) = Array(0,1,2,4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,64,65,67,70) + vPropertiesMatrix(acFormattedField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acGroupBox) = Array(4,6,7,10,11,12,13,14,15,16,17,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,65,70) + vPropertiesMatrix(acImageControl) = Array(0,1,2,6,7,10,27,28,36,37,39,40,41,42,43,44,45,46,51,52,53,62,63,64,65,70) + vPropertiesMatrix(acListBox) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,20,23,24,25,26,27,28,29,36,37,38,39,40,41,42,43,44,45,46,51,52,55,57,62,63,64,65,67,69,70) + vPropertiesMatrix(acNavigationBar) = Array(36,37,39,40,41,42,43,44,45,46) + vPropertiesMatrix(acNumericField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,67,69,70) + vPropertiesMatrix(acPatternField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,58,59,60,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acProgressBar) = Array(0,1,2,6,7,10,27,28,36,37,39,40,41,42,43,44,45,46,51,52,62,63,65,69,70) + vPropertiesMatrix(acRadioButton) = Array(0,4,6,7,10,11,12,13,14,15,16,17,27,28,29,36,37,38,39,40,41,42,43,44,45,46,50,51,52,61,62,63,64,65,67,69,70) + vPropertiesMatrix(acScrollBar) = Array(0,1,2,6,7,10,27,28,30,36,37,39,40,41,42,43,44,45,46,51,52,62,63,64,65,69,70) + vPropertiesMatrix(acTextField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,58,59,60,62,63,64,65,66,67,69,70) + vPropertiesMatrix(acTimeField) = Array(0,1,2,6,7,10,11,12,13,14,15,16,17,19,25,27,28,36,37,39,40,41,42,43,44,45,46,48,51,52,62,63,64,65,66,67,69,70) End Select Dim vProperties() As Variant, i As Integer, iIndex As Integer @@ -1332,6 +1583,13 @@ Dim vSelection As Variant, sSelectedText As String End If Case UCase("Name") _PropertyGet = _Name + Case UCase("OnActionPerformed"), UCase("OnAdjustmentValueChanged"), UCase("OnApproveAction"), UCase("OnApproveReset") _ + , UCase("OnApproveUpdate"), UCase("OnChanged"), UCase("OnErrorOccurred"), UCase("OnFocusGained") _ + , UCase("OnFocusLost"), UCase("OnItemStateChanged"), UCase("OnKeyPressed"), UCase("OnKeyReleased") _ + , UCase("OnMouseDragged"), UCase("OnMouseEntered"), UCase("OnMouseExited"), UCase("OnMouseMoved") _ + , UCase("OnMousePressed"), UCase("OnMouseReleased"), UCase("OnResetted"), UCase("OnTextChanged") _ + , UCase("OnUpdated") + _PropertyGet = Utils._GetEventScriptCode(ControlModel, psProperty, _Name) Case UCase("OptionValue") If Utils._hasUNOProperty(ControlModel, "RefValue") Then If ControlModel.RefValue <> "" Then @@ -1815,6 +2073,18 @@ Dim vSelection As Variant, sText As String, lStart As long ControlModel.MultiSelectionSimpleMode = pvValue End If If Not pvValue Then ControlModel.SelectedItems = Array() ' Cancel selections when MultiSelect becomes False + Case UCase("OnActionPerformed"), UCase("OnAdjustmentValueChanged"), UCase("OnApproveAction"), UCase("OnApproveReset") _ + , UCase("OnApproveUpdate"), UCase("OnChanged"), UCase("OnErrorOccurred"), UCase("OnFocusGained") _ + , UCase("OnFocusLost"), UCase("OnItemStateChanged"), UCase("OnKeyPressed"), UCase("OnKeyReleased") _ + , UCase("OnMouseDragged"), UCase("OnMouseEntered"), UCase("OnMouseExited"), UCase("OnMouseMoved") _ + , UCase("OnMousePressed"), UCase("OnMouseReleased"), UCase("OnResetted"), UCase("OnTextChanged") _ + , UCase("OnUpdated") + If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value + If Not Utils._RegisterEventScript(ControlModel _ + , psProperty _ + , _GetListener(psProperty) _ + , pvValue, _Name _ + ) Then GoTo Trace_Error Case UCase("OptionValue") If Not Utils._hasUNOProperty(ControlModel, "RefValue") Then Goto Trace_Error If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value diff --git a/wizards/source/access2base/Form.xba b/wizards/source/access2base/Form.xba index bf0ab31d87f0..f890214929e0 100644 --- a/wizards/source/access2base/Form.xba +++ b/wizards/source/access2base/Form.xba @@ -209,6 +209,141 @@ Property Get ObjectType() As String ObjectType = _PropertyGet("ObjectType") End Property ' ObjectType (get) +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveCursorMove() As Variant + OnApproveCursorMove = _PropertyGet("OnApproveCursorMove") +End Property ' OnApproveCursorMove (get) + +Property Let OnApproveCursorMove(ByVal pvValue As Variant) + Call _PropertySet("OnApproveCursorMove", pvValue) +End Property ' OnApproveCursorMove (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveParameter() As Variant + OnApproveParameter = _PropertyGet("OnApproveParameter") +End Property ' OnApproveParameter (get) + +Property Let OnApproveParameter(ByVal pvValue As Variant) + Call _PropertySet("OnApproveParameter", pvValue) +End Property ' OnApproveParameter (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveReset() As Variant + OnApproveReset = _PropertyGet("OnApproveReset") +End Property ' OnApproveReset (get) + +Property Let OnApproveReset(ByVal pvValue As Variant) + Call _PropertySet("OnApproveReset", pvValue) +End Property ' OnApproveReset (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveRowChange() As Variant + OnApproveRowChange = _PropertyGet("OnApproveRowChange") +End Property ' OnApproveRowChange (get) + +Property Let OnApproveRowChange(ByVal pvValue As Variant) + Call _PropertySet("OnApproveRowChange", pvValue) +End Property ' OnApproveRowChange (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveSubmit() As Variant + OnApproveSubmit = _PropertyGet("OnApproveSubmit") +End Property ' OnApproveSubmit (get) + +Property Let OnApproveSubmit(ByVal pvValue As Variant) + Call _PropertySet("OnApproveSubmit", pvValue) +End Property ' OnApproveSubmit (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnConfirmDelete() As Variant + OnConfirmDelete = _PropertyGet("OnConfirmDelete") +End Property ' OnConfirmDelete (get) + +Property Let OnConfirmDelete(ByVal pvValue As Variant) + Call _PropertySet("OnConfirmDelete", pvValue) +End Property ' OnConfirmDelete (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnCursorMoved() As Variant + OnCursorMoved = _PropertyGet("OnCursorMoved") +End Property ' OnCursorMoved (get) + +Property Let OnCursorMoved(ByVal pvValue As Variant) + Call _PropertySet("OnCursorMoved", pvValue) +End Property ' OnCursorMoved (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnErrorOccurred() As Variant + OnErrorOccurred = _PropertyGet("OnErrorOccurred") +End Property ' OnErrorOccurred (get) + +Property Let OnErrorOccurred(ByVal pvValue As Variant) + Call _PropertySet("OnErrorOccurred", pvValue) +End Property ' OnErrorOccurred (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnLoaded() As Variant + OnLoaded = _PropertyGet("OnLoaded") +End Property ' OnLoaded (get) + +Property Let OnLoaded(ByVal pvValue As Variant) + Call _PropertySet("OnLoaded", pvValue) +End Property ' OnLoaded (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnReloaded() As Variant + OnReloaded = _PropertyGet("OnReloaded") +End Property ' OnReloaded (get) + +Property Let OnReloaded(ByVal pvValue As Variant) + Call _PropertySet("OnReloaded", pvValue) +End Property ' OnReloaded (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnReloading() As Variant + OnReloading = _PropertyGet("OnReloading") +End Property ' OnReloading (get) + +Property Let OnReloading(ByVal pvValue As Variant) + Call _PropertySet("OnReloading", pvValue) +End Property ' OnReloading (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnResetted() As Variant + OnResetted = _PropertyGet("OnResetted") +End Property ' OnResetted (get) + +Property Let OnResetted(ByVal pvValue As Variant) + Call _PropertySet("OnResetted", pvValue) +End Property ' OnResetted (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnRowChanged() As Variant + OnRowChanged = _PropertyGet("OnRowChanged") +End Property ' OnRowChanged (get) + +Property Let OnRowChanged(ByVal pvValue As Variant) + Call _PropertySet("OnRowChanged", pvValue) +End Property ' OnRowChanged (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnUnloaded() As Variant + OnUnloaded = _PropertyGet("OnUnloaded") +End Property ' OnUnloaded (get) + +Property Let OnUnloaded(ByVal pvValue As Variant) + Call _PropertySet("OnUnloaded", pvValue) +End Property ' OnUnloaded (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnUnloading() As Variant + OnUnloading = _PropertyGet("OnUnloading") +End Property ' OnUnloading (get) + +Property Let OnUnloading(ByVal pvValue As Variant) + Call _PropertySet("OnUnloading", pvValue) +End Property ' OnUnloading (set) + REM ----------------------------------------------------------------------------------------------------------------------- Property Get OpenArgs() As Variant OpenArgs = _PropertyGet("OpenArgs") @@ -599,6 +734,34 @@ End Function REM ----------------------------------------------------------------------------------------------------------------------- REM --- PRIVATE FUNCTIONS --- +REM ----------------------------------------------------------------------------------------------------------------------- + +Private Function _GetListener(ByVal psProperty As String) As String +' Return the X...Listener corresponding with the property in argument + + Select Case UCase(psProperty) + Case UCase("OnApproveCursorMove") + _GetListener = "XRowSetApproveListener" + Case UCase("OnApproveParameter") + _GetListener = "XDatabaseParameterListener" + Case UCase("OnApproveReset"), UCase("OnResetted") + _GetListener = "XResetListener" + Case UCase("OnApproveRowChange") + _GetListener = "XRowSetApproveListener" + Case UCase("OnApproveSubmit") + _GetListener = "XSubmitListener" + Case UCase("OnConfirmDelete") + _GetListener = "XConfirmDeleteListener" + Case UCase("OnCursorMoved"), UCase("OnRowChanged") + _GetListener = "XRowSetListener" + Case UCase("OnErrorOccurred") + _GetListener = "XSQLErrorListener" + Case UCase("OnLoaded"), UCase("OnReloaded"), UCase("OnReloading"), UCase("OnUnloaded"), UCase("OnUnloading") + _GetListener = "XLoadListener" + End Select + +End Function ' _GetListener V1.7.0 + REM ----------------------------------------------------------------------------------------------------------------------- Public Sub _Initialize(psName As String) ' Set pointers to UNO objects @@ -661,8 +824,11 @@ Private Function _PropertiesList() As Variant If IsLoaded Then _PropertiesList = Array("AllowAdditions", "AllowDeletions", "AllowEdits", "Bookmark" _ , "Caption", "CurrentRecord", "Filter", "FilterOn", "Height", "IsLoaded" _ - , "Name", "ObjectType", "OpenArgs", "OrderBy", "OrderByOn" _ - , "RecordSource", "Visible", "Width" _ + , "Name", "ObjectType", "OnApproveCursorMove", "OnApproveParameter" _ + , "OnApproveReset", "OnApproveRowChange", "OnApproveSubmit", "OnConfirmDelete" _ + , "OnCursorMoved", "OnErrorOccurred", "OnLoaded", "OnReloaded", "OnReloading" _ + , "OnResetted", "OnRowChanged", "OnUnloaded", "OnUnloading", "OpenArgs" _ + , "OrderBy", "OrderByOn", "RecordSource", "Visible", "Width" _ ) ' Recordset removed Else _PropertiesList = Array("IsLoaded", "Name" _ @@ -680,13 +846,15 @@ Private Function _PropertyGet(ByVal psProperty As String) As Variant 'Execute Dim oDatabase As Object, vBookmark As Variant, vEMPTY As Variant -Dim oObject As Object +Dim i As Integer, oObject As Object + _PropertyGet = vEMPTY Select Case UCase(psProperty) Case UCase("Name"), UCase("IsLoaded") Case Else : If Not IsLoaded Then Goto Trace_Error_Form End Select + Select Case UCase(psProperty) Case UCase("AllowAdditions") _PropertyGet = DatabaseForm.AllowInserts @@ -720,6 +888,11 @@ Dim oObject As Object _PropertyGet = _Name Case UCase("ObjectType") _PropertyGet = _Type + Case UCase("OnApproveCursorMove"), UCase("OnApproveParameter"), UCase("OnApproveReset"), UCase("OnApproveRowChange") _ + , UCase("OnApproveSubmit"), UCase("OnConfirmDelete"), UCase("OnCursorMoved"), UCase("OnErrorOccurred") _ + , UCase("OnLoaded"), UCase("OnReloaded"), UCase("OnReloading"), UCase("OnResetted"), UCase("OnRowChanged") _ + , UCase("OnUnloaded"), UCase("OnUnloading") + _PropertyGet = Utils._GetEventScriptCode(DatabaseForm, psProperty, _Name, True) Case UCase("OpenArgs") _PropertyGet = _OpenArgs Case UCase("OrderBy") @@ -784,11 +957,12 @@ Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Varia _PropertySet = True 'Execute -Dim iArgNr As Integer +Dim iArgNr As Integer, i As Integer Dim oDatabase As Object If _Isleft(_A2B_.CalledSub, "Form.") Then iArgNr = 1 Else iArgNr = 2 If Not IsLoaded Then Goto Trace_Error_Form + Select Case UCase(psProperty) Case UCase("AllowAdditions") If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value @@ -831,6 +1005,16 @@ Dim oDatabase As Object ContainerWindow.IsMinimized = False End If ContainerWindow.setPosSize(0, 0, 0, pvValue, com.sun.star.awt.PosSize.HEIGHT) + Case UCase("OnApproveCursorMove"), UCase("OnApproveParameter"), UCase("OnApproveReset"), UCase("OnApproveRowChange") _ + , UCase("OnApproveSubmit"), UCase("OnConfirmDelete"), UCase("OnCursorMoved"), UCase("OnErrorOccurred") _ + , UCase("OnLoaded"), UCase("OnReloaded"), UCase("OnReloading"), UCase("OnResetted"), UCase("OnRowChanged") _ + , UCase("OnUnloaded"), UCase("OnUnloading") + If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value + If Not Utils._RegisterEventScript(DatabaseForm _ + , psProperty _ + , _GetListener(psProperty) _ + , pvValue, _Name, True _ + ) Then GoTo Trace_Error Case UCase("OrderBy") If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue) diff --git a/wizards/source/access2base/Root_.xba b/wizards/source/access2base/Root_.xba index 4351d623cc56..3aceacddcc87 100644 --- a/wizards/source/access2base/Root_.xba +++ b/wizards/source/access2base/Root_.xba @@ -25,6 +25,7 @@ Private TraceLogCount As Integer Private TraceLogLast As Integer Private TraceLogMaxEntries As Integer Private CalledSub As String +Private DebugPrintShort As Boolean Private Introspection As Object ' com.sun.star.beans.Introspection Private VersionNumber As String ' Actual Access2Base version number Private Locale As String @@ -47,6 +48,7 @@ Dim vCurrentDoc() As Variant TraceLogLast = 0 TraceLogMaxEntries = 0 CalledSub = "" + DebugPrintShort = True Locale = L10N._GetLocale() Set Introspection = CreateUnoService("com.sun.star.beans.Introspection") Set FindRecord = Nothing diff --git a/wizards/source/access2base/SubForm.xba b/wizards/source/access2base/SubForm.xba index 98af11131c2f..832e8c12fc7e 100644 --- a/wizards/source/access2base/SubForm.xba +++ b/wizards/source/access2base/SubForm.xba @@ -123,6 +123,141 @@ Public Function pName() As String ' For compatibility with < V0.9.0 pName = _PropertyGet("Name") End Function ' pName (get) +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveCursorMove() As Variant + OnApproveCursorMove = _PropertyGet("OnApproveCursorMove") +End Property ' OnApproveCursorMove (get) + +Property Let OnApproveCursorMove(ByVal pvValue As Variant) + Call _PropertySet("OnApproveCursorMove", pvValue) +End Property ' OnApproveCursorMove (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveParameter() As Variant + OnApproveParameter = _PropertyGet("OnApproveParameter") +End Property ' OnApproveParameter (get) + +Property Let OnApproveParameter(ByVal pvValue As Variant) + Call _PropertySet("OnApproveParameter", pvValue) +End Property ' OnApproveParameter (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveReset() As Variant + OnApproveReset = _PropertyGet("OnApproveReset") +End Property ' OnApproveReset (get) + +Property Let OnApproveReset(ByVal pvValue As Variant) + Call _PropertySet("OnApproveReset", pvValue) +End Property ' OnApproveReset (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveRowChange() As Variant + OnApproveRowChange = _PropertyGet("OnApproveRowChange") +End Property ' OnApproveRowChange (get) + +Property Let OnApproveRowChange(ByVal pvValue As Variant) + Call _PropertySet("OnApproveRowChange", pvValue) +End Property ' OnApproveRowChange (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnApproveSubmit() As Variant + OnApproveSubmit = _PropertyGet("OnApproveSubmit") +End Property ' OnApproveSubmit (get) + +Property Let OnApproveSubmit(ByVal pvValue As Variant) + Call _PropertySet("OnApproveSubmit", pvValue) +End Property ' OnApproveSubmit (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnConfirmDelete() As Variant + OnConfirmDelete = _PropertyGet("OnConfirmDelete") +End Property ' OnConfirmDelete (get) + +Property Let OnConfirmDelete(ByVal pvValue As Variant) + Call _PropertySet("OnConfirmDelete", pvValue) +End Property ' OnConfirmDelete (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnCursorMoved() As Variant + OnCursorMoved = _PropertyGet("OnCursorMoved") +End Property ' OnCursorMoved (get) + +Property Let OnCursorMoved(ByVal pvValue As Variant) + Call _PropertySet("OnCursorMoved", pvValue) +End Property ' OnCursorMoved (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnErrorOccurred() As Variant + OnErrorOccurred = _PropertyGet("OnErrorOccurred") +End Property ' OnErrorOccurred (get) + +Property Let OnErrorOccurred(ByVal pvValue As Variant) + Call _PropertySet("OnErrorOccurred", pvValue) +End Property ' OnErrorOccurred (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnLoaded() As Variant + OnLoaded = _PropertyGet("OnLoaded") +End Property ' OnLoaded (get) + +Property Let OnLoaded(ByVal pvValue As Variant) + Call _PropertySet("OnLoaded", pvValue) +End Property ' OnLoaded (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnReloaded() As Variant + OnReloaded = _PropertyGet("OnReloaded") +End Property ' OnReloaded (get) + +Property Let OnReloaded(ByVal pvValue As Variant) + Call _PropertySet("OnReloaded", pvValue) +End Property ' OnReloaded (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnReloading() As Variant + OnReloading = _PropertyGet("OnReloading") +End Property ' OnReloading (get) + +Property Let OnReloading(ByVal pvValue As Variant) + Call _PropertySet("OnReloading", pvValue) +End Property ' OnReloading (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnResetted() As Variant + OnResetted = _PropertyGet("OnResetted") +End Property ' OnResetted (get) + +Property Let OnResetted(ByVal pvValue As Variant) + Call _PropertySet("OnResetted", pvValue) +End Property ' OnResetted (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnRowChanged() As Variant + OnRowChanged = _PropertyGet("OnRowChanged") +End Property ' OnRowChanged (get) + +Property Let OnRowChanged(ByVal pvValue As Variant) + Call _PropertySet("OnRowChanged", pvValue) +End Property ' OnRowChanged (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnUnloaded() As Variant + OnUnloaded = _PropertyGet("OnUnloaded") +End Property ' OnUnloaded (get) + +Property Let OnUnloaded(ByVal pvValue As Variant) + Call _PropertySet("OnUnloaded", pvValue) +End Property ' OnUnloaded (set) + +REM ----------------------------------------------------------------------------------------------------------------------- +Property Get OnUnloading() As Variant + OnUnloading = _PropertyGet("OnUnloading") +End Property ' OnUnloading (get) + +Property Let OnUnloading(ByVal pvValue As Variant) + Call _PropertySet("OnUnloading", pvValue) +End Property ' OnUnloading (set) + REM ----------------------------------------------------------------------------------------------------------------------- Property Get ObjectType() As String ObjectType = _PropertyGet("ObjectType") @@ -198,9 +333,9 @@ Dim vProperty As Variant, vPropertiesList() As Variant, sObject As String vPropertiesList = _PropertiesList() sObject = Utils._PCase(_Type) If IsMissing(pvIndex) Then - vProperty = PropertiesGet._Properties(sObject, _Name, vPropertiesList) + vProperty = PropertiesGet._Properties(sObject, _Shortcut, vPropertiesList) Else - vProperty = PropertiesGet._Properties(sObject, _Name, vPropertiesList, pvIndex) + vProperty = PropertiesGet._Properties(sObject, _Shortcut, vPropertiesList, pvIndex) vProperty._Value = _PropertyGet(vPropertiesList(pvIndex)) End If @@ -377,12 +512,43 @@ End Function REM ----------------------------------------------------------------------------------------------------------------------- REM --- PRIVATE FUNCTIONS --- REM ----------------------------------------------------------------------------------------------------------------------- + +Private Function _GetListener(ByVal psProperty As String) As String +' Return the X...Listener corresponding with the property in argument + + Select Case UCase(psProperty) + Case UCase("OnApproveCursorMove") + _GetListener = "XRowSetApproveListener" + Case UCase("OnApproveParameter") + _GetListener = "XDatabaseParameterListener" + Case UCase("OnApproveReset"), UCase("OnResetted") + _GetListener = "XResetListener" + Case UCase("OnApproveRowChange") + _GetListener = "XRowSetApproveListener" + Case UCase("OnApproveSubmit") + _GetListener = "XSubmitListener" + Case UCase("OnConfirmDelete") + _GetListener = "XConfirmDeleteListener" + Case UCase("OnCursorMoved"), UCase("OnRowChanged") + _GetListener = "XRowSetListener" + Case UCase("OnErrorOccurred") + _GetListener = "XSQLErrorListener" + Case UCase("OnLoaded"), UCase("OnReloaded"), UCase("OnReloading"), UCase("OnUnloaded"), UCase("OnUnloading") + _GetListener = "XLoadListener" + End Select + +End Function ' _GetListener V1.7.0 + REM ----------------------------------------------------------------------------------------------------------------------- Private Function _PropertiesList() As Variant _PropertiesList = Array("AllowAdditions", "AllowDeletions", "AllowEdits", "CurrentRecord" _ , "Filter", "FilterOn", "LinkChildFields", "LinkMasterFields", "Name" _ - , "ObjectType", "OrderBy", "OrderByOn", "Parent", "RecordSource" _ + , "ObjectType", "OnApproveCursorMove", "OnApproveParameter" _ + , "OnApproveReset", "OnApproveRowChange", "OnApproveSubmit", "OnConfirmDelete" _ + , "OnCursorMoved", "OnErrorOccurred", "OnLoaded", "OnReloaded", "OnReloading" _ + , "OnResetted", "OnRowChanged", "OnUnloaded", "OnUnloading", "OrderBy" _ + , "OrderByOn", "Parent", "RecordSource" _ ) ' Recordset removed End Function ' _PropertiesList @@ -442,10 +608,17 @@ Dim oDatabase As Object, vBookmark As Variant, vEMPTY As Variant _PropertyGet = _Name Case UCase("ObjectType") _PropertyGet = _Type + Case UCase("OnApproveCursorMove"), UCase("OnApproveParameter"), UCase("OnApproveReset"), UCase("OnApproveRowChange") _ + , UCase("OnApproveSubmit"), UCase("OnConfirmDelete"), UCase("OnCursorMoved"), UCase("OnErrorOccurred") _ + , UCase("OnLoaded"), UCase("OnReloaded"), UCase("OnReloading"), UCase("OnResetted"), UCase("OnRowChanged") _ + , UCase("OnUnloaded"), UCase("OnUnloading") + _PropertyGet = Utils._GetEventScriptCode(DatabaseForm, psProperty, _Name) Case UCase("OrderBy") _PropertyGet = _OrderBy Case UCase("OrderByOn") If DatabaseForm.Order = "" Then _PropertyGet = False Else _PropertyGet = True + Case UCase("Parent") ' Only for indirect access from property object + _PropertyGet = Parent Case UCase("Recordset") If DatabaseForm.Command = "" Then Goto Trace_Error ' No underlying data ?? Set oObject = New Recordset @@ -525,6 +698,16 @@ Dim iArgNr As Integer If Not Utils._CheckArgument(pvValue, iArgNr, vbBoolean, , False) Then Goto Trace_Error_Value DatabaseForm.ApplyFilter = pvValue DatabaseForm.reload() + Case UCase("OnApproveCursorMove"), UCase("OnApproveParameter"), UCase("OnApproveReset"), UCase("OnApproveRowChange") _ + , UCase("OnApproveSubmit"), UCase("OnConfirmDelete"), UCase("OnCursorMoved"), UCase("OnErrorOccurred") _ + , UCase("OnLoaded"), UCase("OnReloaded"), UCase("OnReloading"), UCase("OnResetted"), UCase("OnRowChanged") _ + , UCase("OnUnloaded"), UCase("OnUnloading") + If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value + If Not Utils._RegisterEventScript(DatabaseForm _ + , psProperty _ + , _GetListener(psProperty) _ + , pvValue, _Name _ + ) Then GoTo Trace_Error Case UCase("OrderBy") If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value _OrderBy = Application._CurrentDb(_DocEntry, _DbEntry)._ReplaceSquareBrackets(pvValue) diff --git a/wizards/source/access2base/Utils.xba b/wizards/source/access2base/Utils.xba index c2b6172b2484..d84259696ce2 100644 --- a/wizards/source/access2base/Utils.xba +++ b/wizards/source/access2base/Utils.xba @@ -215,6 +215,45 @@ Dim oDialogLib As Object End Function +REM ----------------------------------------------------------------------------------------------------------------------- +Public Function _GetEventScriptCode(poObject As Object _ + , ByVal psEvent As String _ + , ByVal psName As String _ + , Optional ByVal pbExtendName As Boolean _ + ) As String +' Extract from the parent of poObject the macro linked to psEvent. +' psName is the name of the object + +Dim i As Integer, vEvents As Variant, sEvent As String, oParent As Object, iIndex As Integer, sName As String + + _GetEventScriptCode = "" + If Not Utils._hasUNOMethod(poObject, "getParent") Then Exit Function + + ' Find form index i.e. find control via getByIndex() + If IsMissing(pbExtendName) Then pbExtendName = False + Set oParent = poObject.getParent() + iIndex = -1 + For i = 0 To oParent.getCount() - 1 + sName = oParent.getByIndex(i).Name + If (sName = psName) Or (pbExtendName And (sName = "MainForm" Or sName = "Form")) Then + iIndex = i + Exit For + End If + Next i + If iIndex < 0 Then Exit Function + + ' Find script event + vEvents = oParent.getScriptEvents(iIndex) ' Returns an array + sEvent = Utils._GetEventName(psEvent) ' Targeted event method + For i = 0 To UBound(vEvents) + If vEvents(i).EventMethod = sEvent Then + _GetEventScriptCode = vEvents(i).ScriptCode + Exit For + End If + Next i + +End Function ' _GetEventScriptCode V1.7.0 + REM ----------------------------------------------------------------------------------------------------------------------- Private Function _GetResultSetColumnValue(poResultSet As Object _ , ByVal piColIndex As Integer _ @@ -326,6 +365,15 @@ Dim sComponents() As String, sSubComponents() As String End Function ' FinalProperty +REM ----------------------------------------------------------------------------------------------------------------------- +Public Function _GetEventName(ByVal psProperty As String) As String +' Return the LO internal event name +' Corrects the typo on ErrorOccur(r?)ed + + _GetEventName = Replace(LCase(Mid(psProperty, 3, 1)) & Right(psProperty, Len(psProperty) - 3), "errorOccurred", "errorOccured") + +End Function ' _GetEventName V1.7.0 + REM ----------------------------------------------------------------------------------------------------------------------- Public Function _GetProductName(ByVal Optional psFlag As String) as String 'Return OO product ("PRODUCT") and version numbers ("VERSION") @@ -418,6 +466,7 @@ Public Function _hasUNOMethod(pvObject As Variant, psMethod As String) As Boolea Dim vInspect as Variant _hasUNOMethod = False + If IsNull(pvObject) Then Exit Function On Local Error Resume Next vInspect = _A2B_.Introspection.Inspect(pvObject) _hasUNOMethod = vInspect.hasMethod(psMethod, com.sun.star.beans.MethodConcept.ALL) @@ -431,6 +480,7 @@ Public Function _hasUNOProperty(pvObject As Variant, psProperty As String) As Bo Dim vInspect as Variant _hasUNOProperty = False + If IsNull(pvObject) Then Exit Function On Local Error Resume Next vInspect = _A2B_.Introspection.Inspect(pvObject) _hasUNOProperty = vInspect.hasProperty(psProperty, com.sun.star.beans.PropertyConcept.ALL) @@ -779,6 +829,51 @@ Error_Function: Resume Exit_Function End Function ' _ReadFileIntoArray V1.4.0 +REM ----------------------------------------------------------------------------------------------------------------------- +Function _RegisterEventScript(poObject As Object _ + , ByVal psEvent As String _ + , ByVal psListener As String _ + , ByVal psScriptCode As String _ + , ByVal psName As String _ + , Optional ByVal pbExtendName As Boolean _ + ) As Boolean +' Register a script event (psEvent) to poObject (Form, SubForm or Control) + +Dim i As Integer, oEvent As Object, sEvent As String, oParent As Object, iIndex As Integer, sName As String + + _RegisterEventScript = False + If Not _hasUNOMethod(poObject, "getParent") Then Exit Function + + ' Find object internal index i.e. how to reach it via getByIndex() + If IsMissing(pbExtendName) Then pbExtendName = False + Set oParent = poObject.getParent() + iIndex = -1 + For i = 0 To oParent.getCount() - 1 + sName = oParent.getByIndex(i).Name + If (sName = psName) Or (pbExtendName And (sName = "MainForm" Or sName = "Form")) Then + iIndex = i + Exit For + End If + Next i + If iIndex < 0 Then Exit Function + + sEvent = Utils._GetEventName(psEvent) ' Targeted event method + If psScriptCode = "" Then + oParent.revokeScriptEvent(iIndex, psListener, sEvent, "") + Else + Set oEvent = CreateUnoStruct("com.sun.star.script.ScriptEventDescriptor") + With oEvent + .ListenerType = psListener + .EventMethod = sEvent + .ScriptType = "Script" ' Better than "Basic" + .ScriptCode = psScriptCode + End With + oParent.registerScriptEvent(iIndex, oEvent) + End If + _RegisterEventScript = True + +End Function ' _RegisterEventScript V1.7.0 + REM ----------------------------------------------------------------------------------------------------------------------- Public Sub _ResetCalledSub(ByVal psSub As String) ' Called in bottom of each public function. _A2B_.CalledSub variable is used for error handling diff --git a/wizards/source/access2base/acConstants.xba b/wizards/source/access2base/acConstants.xba index 446d1aa9279b..a7dcda83879b 100644 --- a/wizards/source/access2base/acConstants.xba +++ b/wizards/source/access2base/acConstants.xba @@ -8,7 +8,7 @@ REM ============================================================================ Option Explicit REM Access2Base ----------------------------------------------------- -Global Const Access2Base_Version = "1.6.0" +Global Const Access2Base_Version = "1.7.0" REM AcCloseSave REM ----------------------------------------------------------------- -- cgit