Paste button to buttonbar: Icon is not shown

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

Moderators: Hacker, petermad, Stefan2, white

User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Paste button to buttonbar: Icon is not shown

Post by *MVV »

When I paste button that contains external icon, TC pastes button with blank icon, and only when I then open button's properties and click OK, TC shows icon on the button.

Example:

Code: Select all

TOTALCMD#BAR#DATA 
%ComSpec% /c
for /f "delims=" %%a in (%F) do move "%%a" ..
%windir%\system32\shell32.dll,146 
Move one level up

1 
-1
User avatar
petermad
Power Member
Power Member
Posts: 16032
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

I cannot confirm this.

Pasted your code to my buttton bar, and an icon with a nice green arrow appeared immediately.

Maybe your .br2 file is corrupt - try and delete it to have it totally refreshed.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I tried this on another computer - and same trouble. Maybe you can't confirm it because of your Windows 7? :wink:

Both PCs have Windows XP installed, and on both given button pastes with blank icon.

I tried to paste button to different bars (including new one) - same result.

BTW, if I copy pasted button and paste it again, it pastes correctly!

I found where error appears! If line with icon contains trailing space, button being pasted with blank icon!!! So if you copy source button code, all will work fine, but if you copy button code from code block in the post, your browser will copy lines with trailing spaces, so button will be pasted with blank icon!

So easy solution is to ignore trailing spaces on every line of button code when uses pastes button to buttonbar. :!:

BTW, I don't understand why TC cannot resolve icon index if it has trailing space. I always calculate strings to numbers from given character up to first non-digit, so I get right number anyway.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Win2K:
The last icon (index) in shell32.dll is 107.
If I change the 146 (icon index) in your code to 107, then it pastes correctly.

What's the maximum icon index for Shell32.dll under WinXP?
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3893
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

What's the maximum icon index for Shell32.dll under WinXP?
It is 237 on WinXP
#5767 Personal license
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

MVV wrote:I don't understand why TC cannot resolve icon index if it has trailing space.
I think the problem is caused by FindFirstFile because if you called it to check file existence, it is return False if the path starting with <Space>, so when TC call it to see if the icon file exist or not, it return False and therefore TC skip resolve the icon.

MVV wrote:and only when I then open button's properties and click OK, TC shows icon on the button.
That's because trailing space are removed.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ts4242 wrote:I think the problem is caused by FindFirstFile because if you called it to check file existence, it is return False if the path starting with <Space>, so when TC call it to see if the icon file exist or not, it return False and therefore TC skip resolve the icon.
I think it is not such case. Buggy line with icon looks like this: <path_to_icon>,<icon_index><buggy_space>. So this space can't be a part of filename anyway since filename ends at comma but buggy space is at the end of line after icon index that should be calculated correctly even if there is a space after it.
Balderstrom wrote:Win2K:
The last icon (index) in shell32.dll is 107.
If I change the 146 (icon index) in your code to 107, then it pastes correctly.
Just write space after number 107 and copy text with this space - and you will see that pasted button's icon is blank. :wink:
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

2MVV

I see.

It seems that if there is any space before or after the icon index, TC cannot get it.
User avatar
petermad
Power Member
Power Member
Posts: 16032
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2MVV
Maybe you can't confirm it because of your Windows 7?
I am using Xp SP3.

But anyway, I can confirm the bug if I add a space either before and/or after the icon path.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Confirmed, space before and/or after the 107 (under Win2K) and the Icon isn't shown.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Well, you've got it:) trailing space may be added just while copying button code from forum message, so it can be really buggy for user who don't know that there should be no trailing spaces (and he may not see this space at all like me when I copied button text from first post of this topic).
petermad wrote:
Maybe you can't confirm it because of your Windows 7?
I am using Xp SP3.
Ah, I'm sorry, it is not you, it is ts4242 wrote that he has W7. :oops:
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Indeed this seems to be a bug of certain browsers, which copy a space which just isn't there.

The TOTALCMD#BAR#DATA clipboard object isn't really meant to be posted online, it's just for internal copy+paste within TC...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think it is not so hard to remove trailing spaces since you anyway need to split text to lines. :)
And, why not to exchange TC buttons online? It will be good for TC.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

2MVV,

What does that button do?
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Boofo wrote:What does that button do?
Moves selected objects one level up according to hint. :wink:
But it is just an example on which I've noticed this bug.
Post Reply