|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Robert Webb
|
Dec 15, 2008 - 11:35 PM
|
Hi,
We would like to provide an extra level of customization for our users, by allowing them to create new toolbar buttons which execute commands using our scripting language.
Although Prof-UIS’s customization allows users to create new toolbars and drag commands onto them, there’s no way to add to the list of commands itself. This is what we would need, with the user supplying commands from our scripting language to be executed when the button is pushed.
Any thoughts on the best way to implement this? Is there any way to integrate such a system into the existing customization dialog box? Even if the feature to create new commands was not available within the customization dialog itself, it would still be nice to see these user-commands, once created, appear within the customization list and be able to drag them onto toolbars etc.
I imagine each new command will need a new resource ID. But if the IDs are auto-generated as new commands are created, then a given command could end up with a different ID depending on what order commands were created. Maybe this isn’t an issue, but seems like it could somehow be a problem, maybe when restoring toolbar state from the registry. If user provides an ID, then there could be clashes between scripts from different users who chose the same ID, so I think they need to be auto-generated.
Also, the user will need to provide their own toolbar bitmaps somehow.
Thanks,
Rob.
|
|
Technical Support
|
Dec 18, 2008 - 11:42 AM
|
This feature is already implemented in Prof-UIS. The ProfAuto library (a.k.a. Prof-UIS Automation Pack) is the set of COM wrapper objects around the customizable toolbars and menus. In simple words, the ProfAuto library is the extended version of the CExtCustomizeSite class. We guess the ActiveScripts sample application implements what you need. The ProfAuto library allows you to allocate new commands and load images into them. The command identifiers can be either preliminary known or allocated on-the-fly. The scripting support also discussed in the following article:
http://www.prof-uis.com/prof-uis/tech-support/feature-articles/scripting-support-in-prof-uis-applications.aspx
Some details which will be interesting for you after you took a closer look at the Prof-UIS Automation Pack. The <cpde>IExtAutoCommandsCollection::Add()</code> allows you to allocate new command. If the specified command identifier is zero, then it will be allocated automatically. The IExtAutoCommand::CommandID property returns command identifier. So, you know the command identifier even if it was allocated dynamically. The ExtAutoCommand::Name property specifies internal command name. It must be unique for all the command objects. This extended command property which is supported by ProfAuto and not supported in Prof-UIS. The command names allow you to work with commands more convinient because scripts does not need to know un-recognizable command identifier values. Besides, the command names allow you to allocate and find commands easier. The IExtAutoCommandsCollection::Item() method can return command object by its name or by its identifier.
Additionally, the COM objects provided by the ProfAuto library support connection points. This means you can use automation enabled like scripts for handing events of toolbar buttons/menu items - not only to modify toolbars and menus.
|
|