[Solved] Toolbar button with icon
[Solved] Toolbar button with icon
Is there any possibility to add a toolbar button with icon to a new toolbar using basic code?
Last edited by nilman70 on Wed Nov 06, 2024 5:18 pm, edited 2 times in total.
OpenOffice 3.1 on Windows Vista
Re: Toolbarbutton with icon
Sure, what are you trying to do?
Add a new toolbar to a single Writer document or to all Writer documents?
Is it an existing Writer command or your own macro you want to call?
Different code applies depending.
Add a new toolbar to a single Writer document or to all Writer documents?
Is it an existing Writer command or your own macro you want to call?
Different code applies depending.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Toolbarbutton with icon
You can use a prepared Template for the new, "empty" documents. Just create the toolbar manually in scope of the document, and save it as a Template. Open that Template, when you need the additional toolbar.
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: Toolbarbutton with icon
I have multiple template files for different languages, de, en, es, gr, etc.. And the template names would be template_de, template_en, template_es, etc. but with a common code to maintain which will depending on the language, i.e. name of the template file will create different toolbar buttons, as there are different language specific features, e.g. de has ligature or fraktur which en/es do not.
When a new writer document is opened for that template, based on the language (or name of the template), one or more different icon toolbar buttons will dynamically appear and clicking on them own macro code will get executed.
Of course, this could be done by adding all the needed buttons right in the beginning and disabling/deleting them or setting their command URL differently during the start based on the language. But I was looking into the possibility of doing all this dynamically.
OpenOffice 3.1 on Windows Vista
Re: Toolbarbutton with icon
Than a template, build an OXT seems to be a better solution.
Did you have a look to code snippet? viewtopic.php?t=108470&hilit=toolbar
Did you have a look to code snippet? viewtopic.php?t=108470&hilit=toolbar
Co-admin french forum branch
Re: Toolbarbutton with icon
Not yet, thanks, I will go through the code.Bidouille wrote: ↑Wed Nov 06, 2024 11:19 am Than a template, build an OXT seems to be a better solution.
Did you have a look to code snippet? viewtopic.php?t=108470&hilit=toolbar
OpenOffice 3.1 on Windows Vista
Re: Toolbarbutton with icon
Thanks a lot ~Bidouille, I could get that snippet running with imagebutton, listbox, etc.
OpenOffice 3.1 on Windows Vista
Re: [Solved] Toolbar button with icon
That code snippet of mine crashes so I wouldn't use it -- as said in the last post if you want to use a complex control on a toolbar you should instead use a dialog and set its parent on creation to the toolbar panel.
Adding a toolbar and normal buttons though is easier. The attached document shows how to do this for a module eg Writer module/all Writer documents. Run test and it should create a toolbar with buttons. Unfortunately the page I based my code on looks to be no longer available. Doing it for one document instead of a module, from memory which can be faulty I think you may have to do something similar but use the document frame's layoutmanager.
Why not just have the same button for all languages though - and in the macro it calls identify the language and run the relevant code?
Adding a toolbar and normal buttons though is easier. The attached document shows how to do this for a module eg Writer module/all Writer documents. Run test and it should create a toolbar with buttons. Unfortunately the page I based my code on looks to be no longer available. Doing it for one document instead of a module, from memory which can be faulty I think you may have to do something similar but use the document frame's layoutmanager.
Why not just have the same button for all languages though - and in the macro it calls identify the language and run the relevant code?
- Attachments
-
- toolbar macro.odt
- (11.93 KiB) Downloaded 125 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: [Solved] Toolbar button with icon
Thanks ~Jeje, I will go through the code...
OpenOffice 3.1 on Windows Vista