Page 1 of 1

Ctbicon() separate icon and background colour.

Posted: 12 Jan 2026 11:52
by eil
Currently ctbicon() has icon and background as one field, so you can't set/change those individually.
Would be good to have background separated into 2nd parameter after comma, and current shape/darkmode param moved to 3rd one.

Re: Ctbicon() separate icon and background colour.

Posted: 15 Jan 2026 09:50
by admin
You can't set/change those individually? Why not? They are separated by an asterisk instead of a comma, who cares?

I can't change the syntax anyway. Would break old code.

Re: Ctbicon() separate icon and background colour.

Posted: 16 Jan 2026 13:04
by eil
Well, i can't do this ctbicon(*#F6F6F6,r) to simply add background to button's icon without changing icon.
You can't change syntax to keep old code intact, but maybe you can add an enhancement, that if there is nothing before asterisk the icon is kept as is?(not erased with background solely)

Re: Ctbicon() separate icon and background colour.

Posted: 16 Jan 2026 18:06
by klownboy
Hi eil, thanks for bringing this topic up. I played around with the subject feature this morning because honestly I forgot changing the icon background was possible. You do have to specify the icon you're dealing with (the original) (or change the icon) when changing the background using a format like the following in a script,
ctbicon("APPLE_HALF.ICO*#F6F6F6,rd", 36); and in the Edit User Button dialog something like this works without quoting, APPLE_HALF.ICO*#F6F6F6,rd It might be handy to accentuate a state change or left vs right action.

Edit: I suppose the most important factor is when changing the background using the above, I haven't noticed any flashing or the icon itself being redrawn. It may be that XY is so fast that I can't see it or it's smart enough to know not to redraw the icon when you're simply changing the background.

Re: Ctbicon() separate icon and background colour.

Posted: 17 Jan 2026 16:26
by admin
eil wrote: 16 Jan 2026 13:04 Well, i can't do this ctbicon(*#F6F6F6,r) to simply add background to button's icon without changing icon.
You can't change syntax to keep old code intact, but maybe you can add an enhancement, that if there is nothing before asterisk the icon is kept as is?(not erased with background solely)
Good idea, next beta. :cup:

Re: Ctbicon() separate icon and background colour.

Posted: 17 Jan 2026 17:19
by klownboy
Eil and Don, that was a good idea (implemented in v28.10.0410). Hopefully I didn't come across as negative to it by making the above comment. :tup: :ninja:

Don, I assume that "*#F6A6F6,r" by itself will not work in the Edit User Button dialog. It's only intended to be used with SC ctbicon as the beta notes state.

Re: Ctbicon() separate icon and background colour.

Posted: 17 Jan 2026 18:02
by admin
Looks like it does not work in the Edit User Button dialog. But maybe it should. I'll consider it.

...

Well, I don't think it should work from there.

Re: Ctbicon() separate icon and background colour.

Posted: 17 Jan 2026 19:31
by klownboy
I was only asking. I agree that it really doesn't need to. From there (Edit User Button) you specify the icon and someone shouldn't expect XYplorer to remember what it was previously (in my opinion).