Azure-ttk-theme icon indicating copy to clipboard operation
Azure-ttk-theme copied to clipboard

Treeview expands on theme change

Open francoisrob opened this issue 2 years ago • 12 comments

The treeview component resizes when switching between light and dark mode and just increasing in width

francoisrob avatar Aug 12 '22 11:08 francoisrob

This is a known bug. Over the last two years, I have tried several times to find out why does it resize, but I could not figure it out.

rdbende avatar Aug 12 '22 11:08 rdbende

Thanks for great rdbene themes !

May I just ask as a side note to this issue: Did you consider to file a bug in the Tk project? https://core.tcl-lang.org/tk/ticket

Note, that it is required to login as anonymous with the ASCII-art password shown on the login page.

Recently, many efforts were done to attack all bugs in Tk.

If you have a test script, I may also try it.

Thank you, Harald

oehhar avatar Aug 13 '22 08:08 oehhar

This is a known bug. Over the last two years, I have tried several times to find out why does it resize, but I could not figure it out.

Do you maybe have a workaround or should I just refrain from using the treeview for now

francoisrob avatar Aug 14 '22 15:08 francoisrob

@oehhar

I tested several different themes, and it turns out that the problem happens when the theme uses a custom image for the Treeview.field element.

Here is a short script that illustrates the bug. Every time you click the "theme use" button, the treeview expands horizontally.

package require Tk 8.6

image create photo tree -data {
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAnXAAAJ1wG
xbhe3AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACJJREFUOI
1jPLF9+38GKgImaho2auCogaMGjho4auBQMhAAyR0DXUEyypsAAAAASUVORK5CYII=
}

ttk::style theme create my_theme -parent clam -settings {
    ttk::style element create Treeview.field image tree
}

pack [ttk::treeview .tree]
pack [ttk::button .btn -text "theme use" -command {ttk::style theme use my_theme}]

ttk::style theme use my_theme

I will open a ticket in the Tk core about this bug.

rdbende avatar Aug 15 '22 16:08 rdbende

Great finding. Please don't forget to mention the Tk version.

Take care, Harald

oehhar avatar Aug 15 '22 16:08 oehhar

https://core.tcl-lang.org/tk/tktview?name=bc602049ab

rdbende avatar Aug 15 '22 19:08 rdbende

The ticket has been addressed, please comment there.

fvogelnew1 avatar Aug 29 '22 20:08 fvogelnew1

Ahh, I feel so newbie I don't know how to comment on a Fossil ticket. @fvogelnew1 Anyways, thanks for your feedback. Using -width 0 -height 0 kind of makes sense now. I'll fix my themes with this tomorrow!

rdbende avatar Aug 29 '22 21:08 rdbende

Commenting a Fossil ticket is done by clicking on the Edit button.

fvogelnew1 avatar Sep 01 '22 19:09 fvogelnew1

I want to thank the great tk team to have fixed this (Peter, Alexandre). Just a remark on fossil:

  • go to the fossil login page: https://core.tcl-lang.org/tk/login
  • log in as "Anonymous" with the ASCII-art password
  • then go to the ticket: https://core.tcl-lang.org/tk/info/bc602049ab64d6ac
  • At the very top of the page in the 2nd line, there is the edit link: https://core.tcl-lang.org/tk/tktedit?name=bc602049ab64d6ac

Thank you all, Harald

oehhar avatar Sep 02 '22 06:09 oehhar

Commenting a Fossil ticket is done by clicking on the Edit button.

Lol it's just too obvious 😅. Thanks!

rdbende avatar Sep 04 '22 08:09 rdbende

Thanks for your feedback in the Tk ticket. I have now closed this ticket.

fvogelnew1 avatar Sep 04 '22 14:09 fvogelnew1