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:
Jean-Pierre Ledure
2025-01-30 16:56:51 +01:00
parent 3227660e55
commit 74f93a222b
2 changed files with 5 additions and 2 deletions

View File

@@ -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))
&apos; So far, vMenuItem is an Integer. Convert to the item name when relevant
If Not ReturnId Then
If vMenuItem &gt; 0 Then vMenuItem = MenuIdentification.Item(CStr(vMenuItem)) Else vMenuItem = &quot;&quot;
End If
Finally:
Execute = vMenuItem

View File

@@ -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) &gt;= 0 Then Event = pvArgs(0) Else Event = Nothing
If IsEmpty(Event) Then Event = Nothing
If IsEmpty(Event) Or IsNull(Event) Then Event = Nothing &apos; Event can be Null when popup built by Python code
If UBound(pvArgs) &gt;= 1 Then X = pvArgs(1) Else X = 0
If UBound(pvArgs) &gt;= 2 Then Y = pvArgs(2) Else Y = 0
If UBound(pvArgs) &gt;= 3 Then SubmenuChar = pvArgs(3) Else SubmenuChar = &quot;&quot;