[GUI] indentation_step_size vs data width

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
white_haired_uncle
Posts: 1207
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

[GUI] indentation_step_size vs data width

Post by white_haired_uncle »

Using a combination of text_alignment, linked_group, and indentation_step_size, I finally got (some of) my tree_view data lined up the way I want it.

Code: Select all

T.row {
                        T.column { T.grid { T.row {
                                T.column { T.tree_view { id = "unit_info_traits",
                                        indentation_step_size = 40,
                                        T.node { id = "header_node",
                                                T.node_definition { T.row { T.column { T.label { id = "header_label", text_alignment = "left", linked_group = "header_label" } } } }
                                        },
                                        T.node { id = "data_node",
                                                T.node_definition { T.row { T.column { T.label { id = "data_label", text_alignment = "left", linked_group = "header_label" } } } }
                        }       }       }       }       }       }
 },                
 T.row {
                        T.column { T.grid { T.row {
                                T.column { T.tree_view { id = "unit_info_abilities",
                                        indentation_step_size = 40,
                                        T.node { id = "header_node",
                                                T.node_definition { T.row { T.column { T.label { id = "header_label", text_alignment = "left", linked_group = "header_label" } } } }
                                        },
                                        T.node { id = "data_node",
                                                T.node_definition { T.row { T.column {  T.label { id = "data_label", text_alignment = "left", linked_group = "header_label"} } } }
                        }       }       }       }       }       }
} 
The problem I'm running into appears to be that when the data in data_label is narrow enough, somehow relative to the indentation_step_size, wesnoth crashes.

Code: Select all

wesnoth: src/gui/widgets/tree_view_node.cpp:580: unsigned int gui2::tree_view_node::place(unsigned int, point, unsigned int): Assertion `width >= indentation_step_size' failed.
Abort(coredump)
He just works
He just works
mario.png (59.64 KiB) Viewed 1579 times
works with indent = 40, crashes with 60
works with indent = 40, crashes with 60
skellie.png (66.66 KiB) Viewed 1579 times
works with indent = 20, crashes with 40
works with indent = 20, crashes with 40
bowman.png (28.33 KiB) Viewed 1579 times
I guess I could try to look for a way to pad the data so it's always wide enough? But I don't know how (just append a bunch of spaces???), and I don't know exactly what is being compared (the issue sure seems related to the width of the data, but the width is always >= indent, so clearly(?) they're not being measured in the same units) so I don't know what needs to be adjusted until something breaks.

I'm also a bit confused as to why the width of the data cares how deeply it is indented in the first place?
Speak softly, and carry Doombringer.
User avatar
Celtic_Minstrel
Developer
Posts: 2236
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [GUI] indentation_step_size vs data width

Post by Celtic_Minstrel »

This also sounds like a bug.

(I'll refrain from asking why you're not using a unit preview pane.)
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
white_haired_uncle
Posts: 1207
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [GUI] indentation_step_size vs data width

Post by white_haired_uncle »

unit preview pane? Sounds interesting, but I don't know what it is.
Speak softly, and carry Doombringer.
User avatar
Celtic_Minstrel
Developer
Posts: 2236
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [GUI] indentation_step_size vs data width

Post by Celtic_Minstrel »

It's one of the available widgets you can choose from.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
white_haired_uncle
Posts: 1207
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [GUI] indentation_step_size vs data width

Post by white_haired_uncle »

Oh that is just extremely cool.

I was actually looking at unit_recall.cfg earlier, hoping I could steal something, but missed that part.

Would be nice if the tooltips worked like they do in the recall menu (smaller font, better position). I've searched for a way to do that but no luck. And I need find a way to fix its size, or at least limit its growth, and give it a scrollbar.
Speak softly, and carry Doombringer.
Post Reply