Kbase P97997: How to translate the tooltip of smart toolbar buttons/actions, usage of the assignAction API
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  6/9/2005 |
|
Status: Unverified
GOAL:
How to translate the tooltip of smart toolbar buttons/actions without using Dynamics
GOAL:
Usage of the assignAction API's for toolbar
GOAL:
How to change properties of an ADM2 smartToolbar
NEGATED FACT(s) Environment):
Dynamics
FACT(s) (Environment):
Progress 9.1E
FIX:
There are three ways to achieve that:
1) Modify the hard coded tooltip in the source:
This is not smart since one have to it again each time Progress is upgraded or a new service pack is applied. Note also that modified adm2 files are officially not supported.
2) Use the Progress Tranman product to translate the ADM2 like the other parts of the application.
This option is particularly interesting if Tranman is already used for the rest of the application
3) A smarter and more dynamic way is to run the assignActionTooltip API in the smartToolbar *before* the smartToolbar is initialized. To do this you have to be carefull to do it in the right place and time, and there is a difference between a Development and Runtime sessions.
The problem relates to the fact that when you run your smartWindow, in intializeObject you are trying to modify the tooltip of the Toolbar. At this point it is not possible to do this because the super procedure action.p has not been started and it has not yet created (setBuffer) the ttAction records that define the toolbar functionality. So when you try and run the window from and icon (without Appbuilder) you see the error:
Action Error:
assign Tooltip() could not find class action 'Add'
When you run the window from a Development session (Appbuilder) you do not see the error because when you open a smartWindow with File->open, all the object super procedures are started. Then when you come to run the window with the RUN button the ttAction records are readily available.
To resolve the problem you can do:
1. From a menu or parent smartWindow initialization, start a dummy smartWindow that contains a toolbar.
2. Immediately that the smartWindow is started destroy it by running destroyObject in its handle.
3. Then run your smartWindow that runs assignActionTooltip from the Menu whenever you like.
The initilizeObject override of the main parent window should look like:
RUN SUPER.
DEFINE VARIABLE h_dummyWin AS HANDLE NO-UNDO.
DEFINE VARIABLE h_win AS HANDLE NO-UNDO.
/* Start and destroy dummywin to start action.p */
IF NOT VALID-HANDLE(h_Dummywin) THEN DO:
RUN Dummy.w PERSISTENT SET h_Dummywin.
RUN initializeObject IN h_dummywin.
RUN destroyObject IN h_Dummywin.
END.
/* Start window that modifies toolbar tooltip */
/* in intializeObject override */
IF NOT VALID-HANDLE(h_win) THEN DO:
RUN wfamily.w PERSISTENT SET h_win.
RUN initializeObject IN h_win.
END.
Now note that the documentation says the following:
<Extract from the Progress Dynamics ADM2 API Reference :>
Action Properties For Toolbar Objects
There are a number of action properties that you use to specify actions for the toolbar. All of these properties can be read and some of them can be set using assign. Action properties are class-level properties, and as a result, changing an action property using assignAction<PropertyGROUND-COLOR: #ffff00">> affects all toolbars that are initialized after the change.
</Extract from the Progress Dynamics ADM2 API Reference :/>
.