Matthias Benkmann wrote:
On 9/2/05, Carsten Driesner <[EMAIL PROTECTED]> wrote:

 Okay, a colleague of mine has created a component based on your
instructions (the idl for the component is attached). The question we
face now is how to get this new component into a toolbar. In the
thread "How to add a button to a newly created toolbar?" you  provided
me with code to add a button to a custom toolbar, however I don't see
how I could adapt this code to add our new component. It would be
great if you could give me a little example for doing this.


Hi Matthias,

You have to associate a command with your toolbar controller. It would be the best solution to use the proposed way for a protocol handler (for more information read chapter 4.7.1 Protocol Handler of the OOo 1.1 Developer's Guide) to prevent command name clashes (something like "org.mycompany.mycomponent", f. e. "org.openoffice.myaddon).

You only have to add this command to your custom toolbar and register your toolbar controller with this command.

Look at the following snippet from "How to add a button to a custom toolbar" which

...
REM *** Create a toolbar controller (provide a command name which is associated with your toolar controller)*** oToolbarItem = CreateToolbarItem( "org.mycompany.mycomponent:MyCommand", "My controller with a combo box" )
...

The OOo toolbar implementation scans all provided commands and creates associated toolbar controller. Your toolbar controller creates the combobox and control it.

So the key points are:
1. Register your toolbar controller with your own command.
2. Create a toolbar item which uses your own command.

Regards,
Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to