feenkcom / gtoolkit

Glamorous Toolkit is the Moldable Development environment. It empowers you to make systems explainable through experiences tailored for each problem.
https://gtoolkit.com
MIT License
1.12k stars 49 forks source link

Display of a columnedList view fails #4027

Open khinsen opened 1 month ago

khinsen commented 1 month ago

In v1.0.1139, I get the following assertion failure when rendering a columnedList view:

gt-assertion-failure

The fix is inserting asString after eachColumn title.

chisandrei commented 1 month ago

What is the source code of the view? Normally the title of the view should be set to a string.

khinsen commented 1 month ago

The title of the view is a string, but not the title of the column, which is a BrRopedText. I have lots of such views, and they have been working fine for a long time.

Here's the source of the specific view I was opening, but it probably doesn't make sense out of context:

gtItemsFor: aView
    <gtView>
    | view |
    view := aView columnedList 
        title: 'Items';
        priority: 1;
        items: [
            (1 to: sequence numberOfRows) collect: [ :row |
                { row. sequence atRow: row } ] ].
    indexVariable
        ifNil: [
            view
                column: 'Index'
                    text: [ :item |
                        item first asRopedText foreground: Color gray  ]
                    width: 50 ]
        ifNotNil: [
            view
                column: indexVariable
                    text: [ :item |
                        (item first * stepSize) asRopedText foreground: Color gray  ]
                    width: 50 ].
    variables withIndexDo: [ :var :i |
        view
            column: var asLeibnizSyntax
            text: [ :item | item second at: i ] ].
    ^ view
chisandrei commented 1 month ago

Aha. Missed that it was the title of the column. I think we assume in most places that the column title is also a string. We can add that asString call there, but it might be also safer to set column title to a string when creating the view. I see that change was made around a year ago.