diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2020-11-28 17:43:59 +0100 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2020-11-29 12:05:09 +0100 |
commit | 0cd33fe7bbe420719cc9c77e4e49deb0743b83ba (patch) | |
tree | 7f1a4bdda82a1e488e136b8b1a0562455dd583d9 /wizards | |
parent | bbcea95619968f95782cd1c90638fd9e553de4f6 (diff) |
ScriptForge - (SF_DialogControl) set OnEvent properties
Applied on DialogControl class:
Assign the triggered script as a string to the OnXxx properties
or as a zero-length string to remove any trigger
Check of control type is included
Change-Id: I199fbfb565740f7ca4576c39bebf7dc9e4052289
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106807
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/sfdialogs/SF_DialogControl.xba | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/wizards/source/sfdialogs/SF_DialogControl.xba b/wizards/source/sfdialogs/SF_DialogControl.xba index 2dce649a1db3..7200f1b25876 100644 --- a/wizards/source/sfdialogs/SF_DialogControl.xba +++ b/wizards/source/sfdialogs/SF_DialogControl.xba @@ -1098,6 +1098,7 @@ Dim vSelection As Variant ' Alias of Model.SelectedItems Dim vList As Variant ' Alias of Model.StringItemList Dim lIndex As Long ' Index in StringItemList Dim sItem As String ' A single item +Dim vCtlTypes As Variant ' Array of allowed control types Dim i As Long Dim cstThisSub As String Const cstSubArgs = "Value" @@ -1185,6 +1186,32 @@ Const cstSubArgs = "Value" End If Case Else : GoTo CatchType End Select + Case UCase("OnActionPerformed"), UCase("OnAdjustmentValueChanged"), UCase("OnFocusGained"), UCase("OnFocusLost") _ + , UCase("OnItemStateChanged"), UCase("OnKeyPressed"), UCase("OnKeyReleased") _ + , UCase("OnMouseDragged"), UCase("OnMouseEntered"), UCase("OnMouseExited"), UCase("OnMouseMoved") _ + , UCase("OnMousePressed"), UCase("OnMouseReleased"), UCase("OnTextChanged") + If Not ScriptForge.SF_Utils._Validate(pvValue, psProperty, V_STRING) Then GoTo Finally + ' Most properties are common to all control types, but there are exceptions + Select Case UCase(psProperty) + Case UCase("OnActionPerformed"), UCase("OnItemStateChanged") + vCtlTypes = Array(CTLBUTTON, CTLCHECKBOX, CTLCOMBOBOX, CTLLISTBOX, CTLRADIOBUTTON) + Case UCase("OnAdjustmentValueChanged") + vCtlTypes = Array(CTLSCROLLBAR) + Case UCase("OnTextChanged") + vCtlTypes = Array(CTLCOMBOBOX, CTLCURRENCYFIELD, CTLDATEFIELD, CTLFILECONTROL, CTLFORMATTEDFIELD _ + , CTLNUMERICFIELD, CTLPATTERNFIELD, CTLTEXTFIELD, CTLTIMEFIELD) + Case Else + vCtlTypes = Array() + End Select + If UBound(vCtlTypes) >= 0 Then + If Not ScriptForge.SF_Array.Contains(vCtlTypes, _ControlType) Then GoTo CatchType + End If + SFDialogs.SF_Register._SetEventScript( _ + _ControlModel _ + , _GetEventName(psProperty) _ + , _GetListener(psProperty) _ + , pvValue _ + ) Case UCase("Page") If Not ScriptForge.SF_Utils._Validate(pvValue, "Page", ScriptForge.V_NUMERIC) Then GoTo Finally If oSession.HasUnoProperty(_ControlModel, "Step") Then _ControlModel.Step = CLng(pvValue) |