Accelerators for option buttons do nothing

I have created a dialogue with option buttons, which have accelerators, but when I press Alt+[symbol] to select an option, nothing happens. Is this supported, and if so, is there a working example somewhere?

I would expect the key combination to mark the option as selected and execute its associated action.
When I click on a button, its action is executed.
The accelerator is always a letter or digit, specified with a ‘~’ in the label and is displayed underlined.
I have the buttons in a group box.
I start the dialogue by executing a macro from a customised menu entry.
The dialogue is intended for use in a spreadsheet, but resides in my shared macros.
I am using Libre Office 7.1.4.2 on Open Suse Linux Leap 15.3.

Hello,

Have tested with:

Version: 7.2.4.1 / LibreOffice Community
Build ID: 27d75539669ac387bb498e35313b970b7fe9c4f9
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Various options tested:

  • Two option buttons with/without macros, with/without group box
  • Three option buttons with/without macros, with/without group box
  • Tried in document and My Macros
  • Tries with designating accelerator and letting system assign
    .
    All worked
    Do not see (quick search) any bug reports regarding this.
    Possibly something with version you are using or the OS. Where did you get your version of LO?
    If problems persist, please provide a sample of what you have.

Edit:

Retest has this working:

DialogAccelerator.ods (11.2 KB)

1 Like

Thanks for your effort; it all sounds encouraging. I shall first study your example and then get back to you here with my results. In any case, I am relieved to hear that it should work.

I installed Libre Office 7.1.4.2_14.22.10.1_x86_64 using Yast from the Update repository for Suse Linux Enterprise 15, as set up by Suse during installation, so I am pretty sure that is OK.

Your example works for me, so I think it is up to me to look for a mistake / misunderstanding in my document.

Only difference I can see is that I have several underscores in names. I shall try to reduce my case to minimal example and post that, unless I spot an answer in the meantime.

P.S. Can I copy my dialogue from MyMacros to a document?
P.P.S. Found it! (Open Dialogue / Export / Import) (How can I copy my dialog from one ods-file to another?)

And your sample works for me. Set code to run Dialogue_Test_Errors and saw no issues. Did not attach any events to them but the selections with keyboard worked as my sample to you did.

Sorry, I slipped up and posted a sample which I had forgotten was for a different problem. I had cleaned up most of it, but forgotten to remove the dialogues, which do not actually use radio buttons. (I have since deleted that post.)

The bug that that sample demonstrates is that Searchable.findAll does not find as much as I believe it should, as can be seen if one runs the macro findAll_Bug: I expect several of the REs to match all three filled cells. I was intending to report that as a bug.

(I am still struggling to locate the differences between your dialogue and mine.)

Marked as solution because it works for me, see below for alternatives

It turns out that radio button accelerators do not work if they are the only controls in the dialogue (apart from a group box). It may be poor design, but I feel it should still work.

Having tested with Ratslinger’s example and compared it with mine (¡and even looked for concealed differences in the .xdl files!), I realised that the difference was that there was no other button in my dialogue. Adding a non-radio button avoided the problem. This may be seen in the attached sheet.
Radio_Button_Bug.ods (12.5 KB)
The first button starts Ratslinger’s dialogue, the second one that does not work, the third one that does.

That is not correct. You need to understand a lot more on dialogs, code and controls. The second one you claim does not work will work AS IS if a button is first selected. Now that is certainly not what is desired!

But this does indicate where the problem lies. If the code is set to place focus on the group box, all works fine.

Your sample back with the mod to second dialog code->
Radio_Button_Bug.ods (12.6 KB)

Thank you for the extra information and new demo; I think I now know enough to move on. This does, however, leave me curious on a few points:

  • Is this behaviour documented somewhere?

    • If so, how could I have found it? Where should I look in order to “understand a lot more on dialogs, code and controls”?
  • Why does the code have to set the focus in the one case but not in the other? How can I tell where to set the focus?

    • (If the previous answer points to documentation which explains this, that is enough for me.)
  • When you say “work AS IS if a button is first selected”, do you mean it works if you first select a button with the mouse?

    • This does not really matter now, but using the mouse defeats the purpose of the accelerators.

Don’t know. Maybe. There is no one place for LO documentation for any module. I used my years of experience. You may want to look at →

To learn LibreOffice Base are there introductions or tutorials?

With the third (so called fix) the button has focus (press spacebar and it executes). Something in the dialog needs focus for the accelerators to be active. It is extremely rare to have a dialog without any button (at least Cancel and/or OK).

Yes.

That is why I posted:

The first and third are of the same construction and they work the same way - option buttons with a push button. As noted is another comment, the second works with focus set on an item in the dialog.