Is it possible to make buttons on the toolbar behave the same as the standard ones in the application?
I mean that my buttons on the custom toolbar are not staying clicked. I want the same behavior on click as with "Align left". Button stays in clicked state.
I used Protocol handler to handle clicks, but I don't know how to mark a button as clicked.
Using MRI, I found only XAccessibleContext, but there is no option to modify values.
[Solved] Mark a button as clicked on the custom toolbar
[Solved] Mark a button as clicked on the custom toolbar
Last edited by pjarocki on Sat Feb 04, 2023 2:50 pm, edited 1 time in total.
LibreOffice 7.4 on Windows 10
Re: Mark a button as clicked on the custom toolbar
Similar topics (controlling a custom toolbar by custom macros):
viewtopic.php?f=45&t=436
viewtopic.php?p=482726
viewtopic.php?t=65287
viewtopic.php?f=45&t=436
viewtopic.php?p=482726
viewtopic.php?t=65287
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Mark a button as clicked on the custom toolbar
with the accessiblecontext of the button this toggles whether its selected
Code: Select all
.setcurrentvalue(.getcurrentvalue xor 1)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Mark a button as clicked on the custom toolbar
Small example using the find toolbar. The find values button in LibreOffice is set to selected.
Code: Select all
lm = thiscomponent.currentcontroller.frame.layoutmanager
fb = lm.getelement("private:resource/toolbar/findbar")
fb.getrealinterface.accessiblecontext.getaccessiblechild(1).setcurrentvalue(1)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Mark a button as clicked on the custom toolbar
Thank you for posting similar topics. I have looked at these topics before I created a new topic. I still was unable to mark the button as selected.Zizi64 wrote: ↑Sat Jan 28, 2023 8:27 pm Similar topics (controlling a custom toolbar by custom macros):
viewtopic.php?f=45&t=436
viewtopic.php?p=482726
viewtopic.php?t=65287
Thank you for posting the example. The code you sent works fine.JeJe wrote: ↑Sun Jan 29, 2023 12:41 pm Small example using the find toolbar. The find values button in LibreOffice is set to selected.
Code: Select all
lm = thiscomponent.currentcontroller.frame.layoutmanager fb = lm.getelement("private:resource/toolbar/findbar") fb.getrealinterface.accessiblecontext.getaccessiblechild(1).setcurrentvalue(1)
I didn't know I can get AccessibleContext from a retrieved item from LayoutManager. This simplifies the code a lot.
LibreOffice 7.4 on Windows 10