bharathy b wrote:
Hi i want to know if this is possible in a toolbar added using a Addon using 
Java.
Suppose the toolbar contains 3 buttons.(A, B,C) Is it possible to have only one button enabled(A is enabled) and the other two buttons disabled. ( B and C disabled) by default.
Hi Bharathy,

Of course this is possible. Your implementation of the dispatch function and the notifications for the controllers must know all the states.

Onclick of button A i would like to enable either B or C.

Just notify the controllers for B or C and provide a FeatureStateEvent with the correct values.
public void trigger(String sEvent) { String buttonName;
                    buttonName=sEvent;
                    if(buttonName.equals("buttonA"))
                          first();
                    else if(buttonName.equals("buttonB"))
                                second();
                    else if(buttonName.equals("buttonC"))
                                third();
          }
public void first()
  {
  // disable second() and third ()
  // check for a condition
  //enable second()
  // or third()
  }
Or can i disable second() and third() in public void initialize and enable second() and third() onclick of button A.
Not really. You can set your internal variables to reflect the correct state. The user interface elements add themselves as listener to your commands and then you have to provide the correct state via FeatureStateEvent and statusChanged(...).
public void initialize( Object[] object ) throws com.sun.star.uno.Exception { // disable second() // disable third ()
          }
public String[] getSupportedServiceNames() {
              return getServiceNames();
          }
When does public void initialize( Object[] object ) gets executed?
Whenever the user interface elements needs a dispatch object from your XDispatchProvider interface. E.g. a menu will indirectly call your intialize method on opening.

Regards,
Carsten

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

Reply via email to