kawamune wrote:
> *** To disable ***
>   acc =
> provider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess",
> prop())
>   propSet = acc.createInstance("com.sun.star.beans.XPropertySet")
>   propSet.setPropertyValue("Command", "macro:///someFunction")
>   acc.insertByName("foo", propSet)
>   acc.commitChanges()
> 
> *** To enable ***
>   acc =
> provider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess",
> prop())
>   acc.removeByName("foo")
>   acc.commitChanges()
> 
> ***************
> 
>  Yes I can change the enable/disable status by above code. But, the
> GUI is not updated immediately when I run the code to enable commands.
> The GUI is updated when I restart OpenOffice at last. Is it possible
> to update GUI as soon as we call the code to enable? Please give me a
> help.

I think the menu should correctly show the new state as it doesn't cache
dispatch objects. If you open the menu, the commands should be disabled.
You are right that this is not true for toolbars as they cache their
dispatch objects.

You use the disabled commands feature for your Basic macro's, but it's
not designed to be used for dynamic tasks. I also see a performance
issue, when we would support dynamic updates for toolbars. As the
disabled commands feature works globally, all toolbars in all frames
must be listener and update their buttons whenever a command is added or
removed from the list. Another drawback of your solution is, you cannot
use context to enable/disable your commands. That means, if you
enable/disable a command with disabled commands this command is
enabled/disabled for all application modules and all states.

If you need dynamic commands, you have to implement a DispatchProvider
service. Unfortunatley, as far as I know, this is not possible using
Basic, so you have to implement with Java or C++.

I can think of a frame based disabled command list, which wouldn't have
the drawbacks I explained before. If you think this would be a good
enhancement, please write an issue using issue tracker.

Regards,
Carsten

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

Reply via email to