Page 1 of 1

[implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blank

Posted: 2024-12-02, 13:32 UTC
by petermad
It could be desirable, that if the"Tooltip" field for a button is blank, then the text at the menu= line in the [em_command] definition in WCMD_LNG.INI (secondary in usercmd.ini) would be used.

See: viewtopic.php?p=464666#p464666 for more discussion

Re: Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blank

Posted: 2024-12-02, 15:02 UTC
by nsp
in a bar file, when you add a command from usercmd.ini wcmd_lng.ini, the tooltip is replicated in the menuXXX.
In order to have same tooltip as original file in sync :
- the tooltip should not be replicated automatically
- if empty it should be read from origin file

-Most of the already created button should have original tooltip never updated unless tooltip is removed.

Re: Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blank

Posted: 2024-12-03, 01:11 UTC
by petermad
2nsp
- if empty it should be read from origin file
Exactly my point - for cm_commands it should be read from wcmd_lng.ini - so that it is English if I use wcmd_eng.ini and in German if I use wcmd_deu.ini - provided that both .ini files have the em_command and they both have a tooltip defined for that command (that they have a: menu= line i the .ini file)

Re: Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blank

Posted: 2024-12-03, 06:00 UTC
by nsp
petermad wrote: 2024-12-03, 01:11 UTC for cm_commands it should be read from wcmd_lng.ini
@Petermad
The main difference i how bar file are built, when using a :
  • cm_ commmand from command browser, the tooltip is not carried unless you edit it manually.
  • With em_ command the tooltip is replicated and so the source is the bar file itself.
Here if creation/maintenance of bar file is not changed, if you decide tomorrow to modify the menu entry for em_xxx in your wincmd_LNG.ini file the tooltip will not be updated if the usercmd.ini em_command have menu entry.

So side to the suggested mechanism, a bar updater tool should remove the tooltip of em_cmd if equal or the one defined in usercmd.ini or wcmd_lng.ini

Re: Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blank

Posted: 2024-12-04, 16:35 UTC
by petermad
history.txt wrote:03.12.24 Added: Button bar, em_command: Read tooltip from em_command definition if none is set for the button itself (32/64)
Thank you fro implementing this :-)

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-05, 05:57 UTC
by nsp
Current implementation only takes the menu entry in usercmd.ini if em_cmd is defined in usercmd.ini it is not possible to have translation in wcmd_eng.ini to override it when switching languages.

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-05, 07:44 UTC
by ghisler(Author)
You cannot define an em_command in usercmd.ini if it's already defined in the current language ini, and vice versa. If you put it in the ini manually, the entry in usercmd.ini takes precedence over the one in the language ini.

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-05, 13:13 UTC
by nsp
ghisler(Author) wrote: 2024-12-05, 07:44 UTC You cannot define an em_command in usercmd.ini if it's already defined in the current language ini, and vice versa. If you put it in the ini manually, the entry in usercmd.ini takes precedence over the one in the language ini.
I was just referring of definition in usercmd.ini and a translation for the menu entry only in wcmd_lng.ini to have common definition and then translations of tooltips.

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-06, 09:30 UTC
by ghisler(Author)
That's an interesting idea, but it could also cause problems. Example: Command em_notepad.
usercmd.ini points to notepad.exe and description "Windows Notepad".
wcmd_fra.ini points to notepad++.exe and description "Éditeur Notepad ++".

With your suggestion, the tooltip would show "Éditeur Notepad ++" but the button would launch notepad.exe.

There are two possible solutions:
1. Always prefer the internal command from the translation - this would break compatibility
or
2. Use the translation from wcmd_fra.ini only if either
- the command is empty, or
- usercmd.ini doesn't contain the command.

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-06, 10:44 UTC
by nsp
ghisler(Author) wrote: 2024-12-06, 09:30 UTC 2. Use the translation from wcmd_fra.ini only if either
- the command is empty, or
- usercmd.ini doesn't contain the command.
Yes this is exactly what I understand as override translation only if empty menu is dedined on the bar file.
Currently if an em_cmdXXX is defined in wcmd_fra.ini this one take precedence over usercmd.ini, by option 2 this will always be the case.
in your case it will launch notepad++ with tooltip in french.
if em_cmdXXX have only menu entry and no command definition in wcmd_fra.ini then it will launch notepad and will have a tooltip in French.

Option 1 will break default behavior of having lng file taking precedence.

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-06, 12:53 UTC
by petermad
2. Use the translation from wcmd_fra.ini only if either
- the command is empty, or
- usercmd.ini doesn't contain the command.
Good idea. What about a third possibility:
- if the command is the same in usercmd.ini and wcmd_fra.ini - then use menu= from wcmd_fra.ini

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-08, 09:38 UTC
by ghisler(Author)
That's a good idea, I will handle that too.

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-11, 16:23 UTC
by petermad
history wrote:08.12.24 Fixed: Button bar, em_command: Prefer tooltip from wcmd_<language>.ini and not usercmd.ini if the same em_command exists in both, and the command is the same or empty in one of the files (32/64)
Works perfectly in TC 11.50rc2 :-)

Re: [implemented] Make Buttons use the tooltip from the [em_command] definition, when the button's tooltip field is blan

Posted: 2024-12-12, 07:49 UTC
by ghisler(Author)
Thanks for suggesting it!