wizards/source/sfwidgets/SF_PopupMenu.xba |    5 ++++-
 wizards/source/sfwidgets/SF_Register.xba  |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 74f93a222bca93010a19b3ba7c5d5e9d4042dfbe
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Thu Jan 30 16:56:51 2025 +0100
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Thu Jan 30 18:21:27 2025 +0100

    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 <j...@ledure.be>
    Tested-by: Jenkins

diff --git a/wizards/source/sfwidgets/SF_PopupMenu.xba 
b/wizards/source/sfwidgets/SF_PopupMenu.xba
index 467e3f748776..d4e5c4d3b075 100644
--- a/wizards/source/sfwidgets/SF_PopupMenu.xba
+++ b/wizards/source/sfwidgets/SF_PopupMenu.xba
@@ -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
diff --git a/wizards/source/sfwidgets/SF_Register.xba 
b/wizards/source/sfwidgets/SF_Register.xba
index 99c9dc9d0d8e..84cc19adc88a 100644
--- a/wizards/source/sfwidgets/SF_Register.xba
+++ b/wizards/source/sfwidgets/SF_Register.xba
@@ -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;

Reply via email to