Wrong icon for the button from certain toolbar

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Wrong icon for the button from certain toolbar

Post by *DrShark »

The sample bar file (.br2 sidecar file included too.)

Update:There'e nothing wrong with tooltips (I added the nobrake space character to the buttons 4 and 5). There's still the issue with the icon in the button #6.

This button bar has 6 buttons:
* 1st just makes a switch to the default bar, there's nothing wrong with this button.
* 2nd and 3rd doesn't have a tooltip set, but the "explorer.exe" tooltip is present for these buttons, and the button's context menu the first item has "explorer.exe" text (upd: it should be like that.)
* buttons 4 and 5 are the same as 3 and 4 except the nobrake space character is used as tooltip; TC shows empty first item of the button's context menu and the empty tooltip itself as expected.
* button 6 has internal command in the "Command:" field and the icon with index 21 of explorer.exe file as an icon, but TC shows default explorer's icon for this button.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

Did you edit the bar file manually in a text editor?

Note that the settings for the last, sixth button says:

Code: Select all

button6=explorer,21
It simply is missing the file extension. Make it like the example below and your bar file should work:

Code: Select all

button6=explorer.exe,21
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

elgonzo wrote:Did you edit the bar file manually in a text editor?
I used Total Commander "Change single button" dialog. Initially I removed absolute path and the extension for explorer.exe and Total Commander used default icon. Then I expected that if I'll change the icon to another one TC will apply it too (Change single button dialog shows explorer.exe icons for explorer icon file string, and it writes that button6=explorer,21 line in bar file after pressing OK), but TC continues to show the default one in the button bar.
elgonzo wrote:Make it like the example below and your bar file should work:

Code: Select all

button6=explorer.exe,21
TC is doing this itself for a problem button, even adding the full path to explorer.exe, after some new button is added to the button bar using "Add" button in "Change button bar" dialog.

I think the following improvements may be added for TC to handle the situatuin when user inserts the program name without extension as the file icon:
* TC can consider the line explorer,# or c:\windows\explorer,# as correct (because it already shows the default icon for such file), and show that icon for the file with the written name and on-the-fly added extension in the %PATHEXT%+alphabet order

OR

* TC can consider such button as incorrect and either:
1) do not show the default icon for such line and don't allow to select from availabele icons in "Change single button" dialog (in other words, the icon file name explorer or [path\to\]explorer should be considered as a name to a file that does not exist.
OR
2) TC can improve the auto-correction in the bar file for this button (like mentioned, currently TC does such auto-correction when new button is added to a button bar). The improvements are:
a) auto-correction should start after user presses "OK" button in the "Change single button" or "Change button bar" dialog, as well as on each Total Commander restart;
b) if the path to icon file is not absolute, in TC should add the extension for the name w/o absolute path (explorer,21 line should be auto-corrected to explorer.exe,21 instead of C:\Windows\explorer.exe). If the bar file is not available for writing, TC can show the default icon like it does currently.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should work now in TC 9.10 beta: TC will add .exe extension by itself if it cannot open any icon with just the name.
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

Yes, I see, but I didn't confirm the fix yet because there are still minor issues:
1) TC doesn't update/show the right icon of such a button if it's placed on a subbar. I.e. if a button:

Code: Select all

TOTALCMD#BAR#DATA 
explorer 

explorer,21 
test 


-1
has been created in pre-beta 3 (which sowed index 0 icon on a button bar) on a subbar, TC 9.10 public beta 1 or 2 will show index 0 icon after a switch to that subbar too;

2) In Change Button Bar dialog, the above (first) icon picker shows index 0 icon (sometimes, but not always, a manual click on the icon in picker makes it show correct icon);

3) The Change Button Bar dialog shows C:\Windows\explorer.exe as the icon file while Change Single Button dialog shows just explorer. I think for consistency the Change Button Bar should show the explorer there too.
Last edited by DrShark on 2017-09-28, 16:17 UTC, edited 1 time in total.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

1) Did you re-load the subbar? Otherwise it uses icon from cache because the .bar file is unchanged.

2) Not confirmed.

3) The Change Button Bar dialog changes to the full path, the Change Single Button dialog doesn't currently do that. I prefer to keep it that way for now.
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

ghisler(Author) wrote:1) Did you re-load the subbar? Otherwise it uses icon from cache because the .bar file is unchanged.
1) Yes, the reason is unreloaded toolbar. It seems that TC reloads its defaut bar on app start, but it doesn't reload/refresh the subbar when switch to it from main bar happens. There is no convenient way to reload the subbar (user have to make some action on bar or its buttons to make reload happen), so maybe it would help if TC would re-load subbar icons after a switch to subbar?
ghisler(Author) wrote:2) Not confirmed.
2) For this issue I described steps to reproduce with sample bar/br2 and screenshots in a mail (went to beta email, subject: TC 9.10 public beta 2: Change Button Bar icon picker issue
ghisler(Author) wrote:3) The Change Button Bar dialog changes to the full path, the Change Single Button dialog doesn't currently do that. I prefer to keep it that way for now.
3) That's the issue: I don't see it as expected behavior when user picks icon with relative path to icon (like explorer) in a Change Button Bar, and it adds full path to it so after user clicked OK there TC changes it to full path in bar file (if it's the last button, only clicking OK in the Change Button Bar dialog is required to make unexpected the changes happen)! If I paste a button to a button bar with relative paths stored in some fields, I expect that fileds will be stored like that unless I intentionally will change it/them to full path(s)!
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

1) Actually it does repload the bar, but only if checksum of the .bar file (stored in .br1 or .br2) changed. Since there was no change, the bar wasn't reloaded.
2) OK, I will check it.
3) Change button bar: It was like this before, so I don't want to change it.
Change single button: This is more like properties of the button, so I don't want to adjust any fields...
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

ghisler(Author) wrote:2) OK, I will check it.
This has been fixed too in TC 9.10 public beta 3.
ghisler(Author) wrote:3) Change button bar: It was like this before, so I don't want to change it.
Change single button: This is more like properties of the button, so I don't want to adjust any fields...
How about following behavor: just show the full path to icon file in Change button bar, as it is now, but if user didn't change (edit) such button, don't change the relative path to full in bar file if user presses OK in Change button bar?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

3) You can prevent it from happening by writing explorer.exe instead of just "explorer". TC calls FindExecutable to find the EXE when no icon can be found under the given name. Therefore this is not just for exe files with no extensions.
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

ghisler(Author) wrote:3) You can prevent it from happening by writing explorer.exe instead of just "explorer".
Well, it's convenient to have both command and the icon wothout extension in the button. This also reduces a bar file size a bit (it matters because the bar file is actually the ini file with its known size limitation).
ghisler(Author) wrote:TC calls FindExecutable to find the EXE when no icon can be found under the given name. Therefore this is not just for exe files with no extensions.
It's still not clear for me why it prevents to implement the simple check:
if user didn't change what FindExecutable returns for no-extension bar icon record -> then don't change the record to FindExecutable value in ini file.
I.e. FindExecutable returns c:\windows\explorer.exe for explorer icon record. Then if user doesn't change c:\windows\explorer.exe in Change Button Bar to something else, like new index of icon in c:\windows\explorer.exe or a new icon file like c:\other\icon.ico -> leave the explorer recored in bar file.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

I think it's more correct to move the topic to fixed bugs. In the the post http://ghisler.ch/board/viewtopic.php?p=332373#332373, where for issues 1) and 3) we'll stay with current behavior, the 1st is very minor and there's a logic behind current behavior for it, while the 3rd issue is only slightly related to the main issue repoted in starting post.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

That's the problem with multiple bug reports per message: If some are fixed and some are unchanged, there isn't a clear location where to put the message.
Author of Total Commander
https://www.ghisler.com
Post Reply