Bug 163175 - Impossible to assign a macro to checkbox button as usual
Summary: Impossible to assign a macro to checkbox button as usual
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.8.1.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-27 07:48 UTC by Thierry Munoz
Modified: 2024-12-10 17:21 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
An exemple of macros not working on LibO 24.8.1 (21.73 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-09-27 13:08 UTC, Thierry Munoz
Details
Problem with chekbox display (7.28 KB, image/png)
2024-10-06 18:14 UTC, Thierry Munoz
Details
Problem with checkbox text (62.07 KB, image/png)
2024-10-06 18:56 UTC, Thierry Munoz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Munoz 2024-09-27 07:48:09 UTC
Hi,

I use 2 macro to assign 2 events on checkbox button. Until now this macro worked without any problem on LibreOffice 7.6 for instance.
Now with LibreOffice 24.8.1, this macro doesn't work but there is no error displayed : it's like the assignation is not done.

Here is the code of the 2 macros :

' assign sScriptURL event as css.awt.XActionListener::actionPerformed.
' event is assigned to the control described by the nIndex in the oForm container
Sub AssignAction(nIndex As Integer, sScriptURL As String, oForm As Object)
  aEvent = CreateUnoStruct("com.sun.star.script.ScriptEventDescriptor")
  With aEvent
    .AddListenerParam = ""
    .EventMethod = "actionPerformed"
    .ListenerType = "XActionListener"
    .ScriptCode = sScriptURL
    .ScriptType = "Script"
  End With
  oForm.registerScriptEvent(nIndex, aEvent)
End Sub


'---------------------------------------------------------------------------

' assign sScriptURL event as css.awt.XActionListener::actionPerformed.
' event is assigned to the control described by the nIndex in the oForm container
Sub AssignStatusModifie(nIndex As Integer, sScriptURL As String, oForm As Object)
  aEvent = CreateUnoStruct("com.sun.star.script.ScriptEventDescriptor")
  With aEvent
    .AddListenerParam = ""
    .EventMethod = "itemStateChanged"
    .ListenerType = "XItemListener"
    .ScriptCode = sScriptURL
    .ScriptType = "Script"
  End With
  oForm.registerScriptEvent(nIndex, aEvent)
End Sub


My LibO version :
Version: 24.8.1.2 (X86_64) / LibreOffice Community
Build ID: 480(Build:2)
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Ubuntu package version: 4:24.8.1-0ubuntu0.22.04.1~lo1
Calc: threaded


Regards
Comment 1 Xisco Faulí 2024-09-27 08:26:26 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Comment 2 Thierry Munoz 2024-09-27 13:08:03 UTC
Created attachment 196743 [details]
An exemple of macros not working on LibO 24.8.1

When you click on the green button, a checkbox "CB1" is created and two events macro are assigned to this checkbox CB1.
It's working with Libo 7.6.7.2 (tested now) but not with 24.8.1 (tested now) : the checkbox is created but the macro aren't attached to it.

You need to erase the checkbox if it existes before clicking the button.
Comment 3 Thierry Munoz 2024-09-27 13:09:57 UTC
I add that I create before the checkbox by macro too and I assign in the same macro the events macro to add after the checkbox is created.
Comment 4 raal 2024-10-04 18:03:56 UTC
Tested with Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 4787fd4fc86230893a6da309f45964116b3a67df
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

When I click green button, the checkbox is created and in the checkbox's properties - Events - are two macros aasigned. looks good to me. Please can zou test with dev version? You can download it here:
http://dev-builds.libreoffice.org/daily/master/
Thank you
Comment 5 Thierry Munoz 2024-10-06 18:13:00 UTC
Hi,
I've tested and it works. But there'i an artefact with the display (see png file).
Comment 6 Thierry Munoz 2024-10-06 18:14:03 UTC
Created attachment 196929 [details]
Problem with chekbox display
Comment 7 Thierry Munoz 2024-10-06 18:48:46 UTC
(In reply to Thierry Munoz from comment #5)
> Hi,
> I've tested and it works. But there'i an artefact with the display (see png
> file).
Tested with :
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 3370e122d7f9edf40895f90706047ceb8ee7229d
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded
Comment 8 Thierry Munoz 2024-10-06 18:56:57 UTC
Created attachment 196931 [details]
Problem with checkbox text

An other picture showing the problem with the checkbox text created.
It seems that the text is repeated with a gap.
Comment 9 Buovjaga 2024-12-10 17:21:29 UTC
(In reply to Thierry Munoz from comment #5)
> Hi,
> I've tested and it works. But there'i an artefact with the display (see png
> file).

Reported as bug 164270.