Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
104
Ultratoolbarsmanager: Tool click code-base
posted

HI at all,

How can I fire the click event of a tool from the Ultratoolbar manually by code?
I read something about a "perform default action" thing somewhere, but can't remember.
I thought about one of the following ways:
Toolbarsmanager.tools("button").performaction ... or ... eventmanager.event("click").activate()
OR OTHERWISE Toolbarsmanager_Toolsclick(me, [set eventargs to buttontool])

But I don't find any way to do this. 

On the second way I don't know how to set/create the eventargs manually to raise the toolsclick event properly.

Have anybody a solution for this?

Thanks

Parents
No Data
Reply
  • 45049
    Verified Answer
    posted

    My recommendation is to encapsulate the functionality you want to occur on a particular tool click into its own method.  You can then call this method from the ToolClick event of the WinToolbarsManager, or programmatically from any other location where you want to perform the same functionality.

    For instance, say I want to have a "Save" tool that saves the current file I'm editing.  I also want to have a "Save" button that, when clicked, does the same thing.  I'd write a "SaveFile()" method, which I'd call from the ToolClick event when the Save tool is clicked, as well as from the button's Click event.

    It's generally not advisable to try to manually "raise" events in this fashion.  The only time where I've seen it useful to "raise" events in this way is when performing automated UI testing - and to my knowledge, what methods we have that allow raising these events are likely internal methods.

Children