How to customize MainMenu caption items?
I'm trying traslate from English.
Changing caption at deign time, it seems be changed, but after compiling, at run time alwais shown in English.
When I worked, lomg time ago, with old version, it were possible.
It's not possible in newer versions?
I tryed change language in RVAControlPanel1, nothing happened.
Thanks in advance.
Customize MainMenu Items
Re: Customize MainMenu Items
It also happens that some icons, whose image is in the image list, appear at design time and do not appear after compiling the app.
And Disabled icons, appear too much dark images at run time.
Why?
And Disabled icons, appear too much dark images at run time.
Why?
-
- Site Admin
- Posts: 17805
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Customize MainMenu Items
1. As for the translation.
Some controls (menu items, toolbar buttons) are linked with actions (their Action property is assigned). When the application runs, their captions and hints are updated from actions, using TRVAControlPanel.Language. You cannot modify these texts in your application: you need to change translation of actions.
Other controls (including top-level menu items) are not linked with action. Their text is assigned in code. In ActionTest demo projects, these assignments are in the main form's Localize method, for example:
This Localize method is called when the application starts (from FormCreate) and after changing TRVAControlPanel.Language.
Do you want to implement translation to a new language or just want to change some captions?
2. As for disabled icons.
What demo did you use as a base?
- Demos\DelphiUnicode\ActionTest\ use special image lists for disabled images. Images in these image lists are pre-created, the only way to change them is drawing new disabled images. The same for Lazarus version.
- Demos\DelphiUnicode\ActionTest_MultiRes\ generates disabled images using rvActionsVirtualImageLists.ilToolbar.DisabledOpacity property. If you modify this property, you can change darkness (opacity) of disabled images.
-
Some controls (menu items, toolbar buttons) are linked with actions (their Action property is assigned). When the application runs, their captions and hints are updated from actions, using TRVAControlPanel.Language. You cannot modify these texts in your application: you need to change translation of actions.
Other controls (including top-level menu items) are not linked with action. Their text is assigned in code. In ActionTest demo projects, these assignments are in the main form's Localize method, for example:
Code: Select all
mitFile.Caption := RVA_GetS(rvam_menu_File);
Do you want to implement translation to a new language or just want to change some captions?
2. As for disabled icons.
What demo did you use as a base?
- Demos\DelphiUnicode\ActionTest\ use special image lists for disabled images. Images in these image lists are pre-created, the only way to change them is drawing new disabled images. The same for Lazarus version.
- Demos\DelphiUnicode\ActionTest_MultiRes\ generates disabled images using rvActionsVirtualImageLists.ilToolbar.DisabledOpacity property. If you modify this property, you can change darkness (opacity) of disabled images.
-
Re: Customize MainMenu Items
Hi.
1. As I said before, changing the language in TRVAControlPanel.Language doesn't change the caption text.
What I'd like is to write the captions my way (if possble).
2. I'll fix the issue with the disabled icons later.
1. As I said before, changing the language in TRVAControlPanel.Language doesn't change the caption text.
What I'd like is to write the captions my way (if possble).
2. I'll fix the issue with the disabled icons later.
-
- Site Admin
- Posts: 17805
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Customize MainMenu Items
Changing TRVAControlPanel.Language is not enough. You need to call additional code to update controls after changing TRVAControlPanel.Language.
In ActionTest demos, this additional code is in the form's Localize method.
First, this method calls RVA_LocalizeForm(Self) to update captions of all actions on this form. This also updates captions of menu items linked to these actions.
Next, this method assigns captions of menu items not linked to actions.
PS: There is one more reason why nothing may happen after changing TRVAControlPanel.Language: actions may be linked to another control panel.
Do you have a single form with TRVAControlPanel? By default, all actions are linked to the first created TRVAControlPanel component. So, if you open a second form containing RVAControlPanel, all its actions sill will be implicitly linked to RVAControlPanel on the first form.
To avoid this problem, either create only one RVAControlPanel, or link all actions to their RVControlPanel explicitly: assign ControlPanel property of all actions.
In ActionTest demos, this additional code is in the form's Localize method.
First, this method calls RVA_LocalizeForm(Self) to update captions of all actions on this form. This also updates captions of menu items linked to these actions.
Next, this method assigns captions of menu items not linked to actions.
PS: There is one more reason why nothing may happen after changing TRVAControlPanel.Language: actions may be linked to another control panel.
Do you have a single form with TRVAControlPanel? By default, all actions are linked to the first created TRVAControlPanel component. So, if you open a second form containing RVAControlPanel, all its actions sill will be implicitly linked to RVAControlPanel on the first form.
To avoid this problem, either create only one RVAControlPanel, or link all actions to their RVControlPanel explicitly: assign ControlPanel property of all actions.
Re: Customize MainMenu Items
Hi.
Thank you very much, you're absolutely right.
Using ActionTest as a base, I can see how to change the language correctly.
I just have one small question: in which unit is the dialog box where you can change the language? That is used in ActionTest demo.
Your explanations have been a great help to me.
Thank you very much, you're absolutely right.
Using ActionTest as a base, I can see how to change the language correctly.
I just have one small question: in which unit is the dialog box where you can change the language? That is used in ActionTest demo.
Your explanations have been a great help to me.
Re: Customize MainMenu Items
Okay, okay.
I've now found the dialog box in RichViewActions.
Thanks for your help.
Best regards.
I've now found the dialog box in RichViewActions.
Thanks for your help.
Best regards.