Button w/o icon: pressed state not shown on bar as menu

Bug reports will be moved here when the described bug has been fixed

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:

Button w/o icon: pressed state not shown on bar as menu

Post by *DrShark »

To reproduce:
1. Add new test subbar to a button bar.
2. Switch to this test button bar and paste 2 test buttons:

Code: Select all

TOTALCMD#BAR#DATA
cm_SwitchLongNames

wcmicons.dll,5


0
2010
and

Code: Select all

TOTALCMD#BAR#DATA
cm_SwitchLongNames

*
Turn &long names on and off


2010
The only difference in buttons is that first one have an icon, and second one doesn't.
4. If buttons are not in pressed state, press first one with an icon: second one without an icon will get the pressed state too.
5. Switch to default bar with arrow button.
6. In the context menu of the button of our custom bar, click "Change...", in opened dialog check "Show as menu" option and press "OK" button.
7. Now press the button of our button bar: its buttons will appear in a menu. Only a test button with an icon will have pressed state, but not the button without icon.
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 »

I can confirm with TC64 9.12 (TC32 not tested).

I guess that TC configures the pull-down menu item without no icon at all instead of using a blank icon. Which could explain why the pull-down menu item fails to render the pressed state of the toggle button. I am not saying that i would like it to have a blank pressed icon. I would much prefer when toggle buttons without an icon show a check mark in pull-down menus when being in pressed state.

Side note:
When you try reproducing DrSharks example, make sure you copy the TOTALCMD#BAR#DATA code block without a white-space character behind the internal cmd number "2010" at the end of the code. (This whitespace seems to be introduced by the selection or copy-to-clipboard function of the web browser - in my case FF ESR - or by one of the browser add-ons i use, so don't blame DrShark for it ;) )

While this white-space does not prevent the toggle button from functioning, copying and pasting the TOTALCMD#BAR#DATA block with it caused the TC toolbar to not render the checked state of this toggle button at all until the toolbar refreshed/updated its internal state (which you can trigger by switching to a another (custom) toolbar and back). Was a fun time to hunt down this little bugger. (I'll write up a new report for that one if no similar one exists and after i crosschecked with TC32.)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Confirmed (and fixed), thanks.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should be fixed in TC 9.20 beta 1, please test it!
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 »

history920.txt wrote:12.03.18 Fixed: Button bar: When shown as dropdown menu, items without an icon are not displayed as pressed (e.g. sort by name button when list sorted by name) (32/64)
history920.txt wrote:13.04.18 Fixed: Button bar, paste button from clipboard: Remove all trailing spaces, they are often added when copying button bar data from a Web browser (32/64)
Both no icon button issue and button code with trailing spaces issue I can confirm fixed, tested in TC 9.20 beta 1 on Vista 32-bit.

There is however one issue left with one example not mentioned in above posts. If TC is without TOTALCMD.INC, it's possible to create a button for internal command like cm_SwitchLongNames, but since there is no INC file to tell TC to what command ID it should match, TC will create it with -1 ID (-1 indicates that the command is an external command, and TC without TOTALCMD.inc will try to launch cm_ command as an external app).
If copied from such TC instance, the button code will be

Code: Select all

TOTALCMD#BAR#DATA 
cm_SwitchLongNames 

* 
Turn &long names on and off 


-1
If pasted in Total Commander instance which has access to TOTALCMD.INC, TC will prefer internal command over ID, so command 2010 will be actually executed.

So the issue is: if such button is pasted into TC instance which has access to TOTALCMD.INC, that Total Commander shows the pressed state for such button with cm_ command and -1 ID only after restart. I asked by email to implement a check for pressed state while button is pasted, so it will immediatly show the state of action button actually makes. So far Christian Ghisler's point is that such button is invalid, so no need to implement such check. But I think since such button works, TC should show its state too.
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: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This isn't a bug. If the template sends -1 as command id, then TC will use that. It will not look up the id again. Just use

Code: Select all

TOTALCMD#BAR#DATA
cm_SwitchLongNames

*
Turn &long names on and off


without command id number if you want TC to look it up. This was added in TC 9.20.
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:This isn't a bug. If the template sends -1 as command id, then TC will use that.
If we're pasting such a button to TC with TOTALCMD.INC present, TC is using ID -1 only as a marker for pressed state until TC restart. But even before restart TC will execute cm_ command for that button, not try "launch external app" as ID tells! So there is inconsistency in what TC executes and for what it shows the pressed state (until restart).
ghisler(Author) wrote:It will not look up the id again. Just use

Code: Select all

TOTALCMD#BAR#DATA
cm_SwitchLongNames

*
Turn &long names on and off


without command id number if you want TC to look it up. This was added in TC 9.20.
It is not a user-friendly solution. What's a big deal to check for TOTALCMD.INC presence when button is pasted, and if present - immediately show pressed state of the internal command for a button with ID like -1 and cm_ command (which will be executed in such a case for a button)?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply