ScriptForge (SFWidgets) fix popup menu bugs
1) when in Python the event argument of CreateScriptService('popupmenu', event) is set to None, an error was raised although not justified. 2) when popupmenu.Execute(False) is run and the user clicks outside the popup menu, the doc says a zero-length string should be returned. It retuned 0. No impact on user documentation. Change-Id: I4e1a1372800a728b994813b021f928fcf2b2603c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180960 Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins
This commit is contained in:
@@ -402,7 +402,10 @@ Check:
|
||||
|
||||
Try:
|
||||
vMenuItem = MenuRoot.Execute(PeerWindow, Rectangle, com.sun.star.awt.PopupMenuDirection.EXECUTE_DEFAULT)
|
||||
If Not ReturnId Then vMenuItem = MenuIdentification.Item(CStr(vMenuItem))
|
||||
' So far, vMenuItem is an Integer. Convert to the item name when relevant
|
||||
If Not ReturnId Then
|
||||
If vMenuItem > 0 Then vMenuItem = MenuIdentification.Item(CStr(vMenuItem)) Else vMenuItem = ""
|
||||
End If
|
||||
|
||||
Finally:
|
||||
Execute = vMenuItem
|
||||
|
@@ -193,7 +193,7 @@ Check:
|
||||
If IsMissing(pvArgs) Or IsEmpty(pvArgs) Then pvArgs = Array()
|
||||
If Not IsArray(pvArgs) Then pvArgs = Array(pvArgs)
|
||||
If UBound(pvArgs) >= 0 Then Event = pvArgs(0) Else Event = Nothing
|
||||
If IsEmpty(Event) Then Event = Nothing
|
||||
If IsEmpty(Event) Or IsNull(Event) Then Event = Nothing ' Event can be Null when popup built by Python code
|
||||
If UBound(pvArgs) >= 1 Then X = pvArgs(1) Else X = 0
|
||||
If UBound(pvArgs) >= 2 Then Y = pvArgs(2) Else Y = 0
|
||||
If UBound(pvArgs) >= 3 Then SubmenuChar = pvArgs(3) Else SubmenuChar = ""
|
||||
|
Reference in New Issue
Block a user