Bug 158157 - Unable to disable commands located in xxxToolbars
Summary: Unable to disable commands located in xxxToolbars
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.2.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
 
Reported: 2023-11-10 09:48 UTC by Alain Romedenne
Modified: 2024-01-24 13:23 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alain Romedenne 2023-11-10 09:48:51 UTC
Description:
I can successfully remove/reset commands that are present in menu pulldowns using 'disable commands' wiki documentation:
https://wiki.documentfoundation.org/Documentation/DevGuide/Writing_UNO_Components#Disable_Commands

I noticed that this does not remove counterpart commands from xxxToolbars such as ‘Tabbed Compact’ and the like.

Steps to Reproduce:
1. Copy the indicated wiki code inside any document
2. Run Main
3. Observe xxxToolbars are unaffected

Actual Results:
Menu pulldowns commands are removed or reset

Expected Results:
Equivalent xxxToolbars commands should be disabled/enabled in parallel


Reproducible: Always


User Profile Reset: No

Additional Info:
Versions past 7.2.5 exhibit a misbehaviour that's reported in bug#157915
Comment 1 Stéphane Guillou (stragu) 2023-11-28 16:35:59 UTC
Thanks Alain. I tried to bibisect bug 157915 and shared my results there, hopefully that gets things moving along. However, the issue I noticed started in 7.4.
When you say "versions past 7.2.5 exhibit a misbehaviour", do you mean that you can reproduce the bug in e.g. 7.2.6? And 7.3.0?

I assume it's not possible to test the issue you describe here in a recent master build, then, correct? But we can safely assume that the behaviour hasn't changed since 7.2 in that regard.
Comment 2 Alain Romedenne 2023-11-29 10:40:46 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)
> Thanks Alain. I tried to bibisect bug 157915 and shared my results there,
> hopefully that gets things moving along. However, the issue I noticed
> started in 7.4.
> When you say "versions past 7.2.5 exhibit a misbehaviour", do you mean that
> you can reproduce the bug in e.g. 7.2.6? And 7.3.0?
> 
> I assume it's not possible to test the issue you describe here in a recent
> master build, then, correct? But we can safely assume that the behaviour
> hasn't changed since 7.2 in that regard.

Hi Stéphane,

By misbehaviour I meant that menu bars do not refresh properly:

1. run _disableCommands() subroutine
   Menus are hidden and become unoperating as expected
2. run _enableCommands() subroutine
   Menus are kept hidden and require to (re)open the doc in order to (re)appear

However running main() routine does not exhibit that behaviour
Comment 3 Buovjaga 2024-01-16 17:22:11 UTC
I tried to reproduce, but I got stuck. I copied the Basic code from https://wiki.documentfoundation.org/Documentation/DevGuide/Writing_UNO_Components#Disabling_Commands_at_Runtime

If I run the main function, the About dialog opens and another dialog opens with the text "Ok, dispatch object for .uno:About" and I am unable to close this dialog. I have to kill the LibreOffice process.

If I run disableCommands, I get

BASIC runtime error.
Property or method not found: stopped.

Pointing to line 94:

EXC.stopped REM Let's bubble-up the error condition

What should I do to reproduce this?
Comment 4 Alain Romedenne 2024-01-17 13:32:58 UTC
(In reply to Buovjaga from comment #3)
> I tried to reproduce, but I got stuck. I copied the Basic code from
> https://wiki.documentfoundation.org/Documentation/DevGuide/
> Writing_UNO_Components#Disabling_Commands_at_Runtime
> 
> If I run the main function, the About dialog opens and another dialog opens
> with the text "Ok, dispatch object for .uno:About" and I am unable to close
> this dialog. I have to kill the LibreOffice process.
> 
> If I run disableCommands, I get
> 
> BASIC runtime error.
> Property or method not found: stopped.
> 
> Pointing to line 94:
> 
> EXC.stopped REM Let's bubble-up the error condition
> 
> What should I do to reproduce this?

Hi Ilmari,

Including the 'About' panel in the test is probably a bad idea as pointed by Noel in bug157915. Please remove "About" from CMD_LIST Basic array when running Main() routine.

If you intend to run routines separately, please make sure they include Main() initialization statements:
Set EXC = New ERROR_RAISER ' Exception artifact
With ...
    ...
End With
CMD_LIST = ...
Comment 5 Alain Romedenne 2024-01-17 13:47:41 UTC
Ilmari, 

I tested the code sample under Win10 using TDF copy of LibO

Can you indicate your OS and LibO versions?
Comment 6 Buovjaga 2024-01-17 15:24:06 UTC
(In reply to Alain Romedenne from comment #4)
> Including the 'About' panel in the test is probably a bad idea as pointed by
> Noel in bug157915. Please remove "About" from CMD_LIST Basic array when
> running Main() routine.

I removed it. I got the File Open dialog, I canceled out. I realised that Linux with kf5 didn't let me close the dialog that popped up. I was able to close it when using the gen backend.

What is the result I am looking for? I see in the description of the code "At the end, the code removes the disabled commands again, otherwise LibreOffice would not be fully usable any longer". I also ran the macro when in Tabbed UI and the running seemed to be the same.

Arch Linux 64-bit, X11
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 88a7384edcd8f4240a659f2c2c7c1258471341f4
CPU threads: 8; OS: Linux 6.7; UI render: default; VCL: x11
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 17 January 2024
Comment 7 Alain Romedenne 2024-01-24 13:23:49 UTC
(In reply to Buovjaga from comment #6)
> (In reply to Alain Romedenne from comment #4)
> > Including the 'About' panel in the test is probably a bad idea as pointed by
> > Noel in bug157915. Please remove "About" from CMD_LIST Basic array when
> > running Main() routine.
> 
> I removed it. I got the File Open dialog, I canceled out. I realised that
> Linux with kf5 didn't let me close the dialog that popped up. I was able to
> close it when using the gen backend.
> 
> What is the result I am looking for? I see in the description of the code
> "At the end, the code removes the disabled commands again, otherwise
> LibreOffice would not be fully usable any longer". I also ran the macro when
> in Tabbed UI and the running seemed to be the same.
> 
> Arch Linux 64-bit, X11
> Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
> Build ID: 88a7384edcd8f4240a659f2c2c7c1258471341f4
> CPU threads: 8; OS: Linux 6.7; UI render: default; VCL: x11
> Locale: fi-FI (fi_FI.UTF-8); UI: en-US
> Calc: threaded
> Built on 17 January 2024

For Open SelectAll, Quit command sequence, you should get:

1. FileOpen dialog that you may cancel
 - Ok msg box stating that UNO dispatch command went fine
2. Writer doc content selected or Basic IDE code selected or else ..
 - Ok msg box stating that UNO dispatch command went fine
3. Quit dialog that you may cancel
 - Ok msg box stating that UNO dispatch command went fine
Then..
4. 3 Msg boxes boxes stating that Open, SelectAll and Quit UNO commands aren't available