Closed SamSandq closed 8 months ago
In TableView, the text alignment is cell-based and not column-based. You have to return the desired alignment in EvTbCell
result in ekGUI_EVENT_TBL_CELL
event.
case ekGUI_EVENT_TBL_CELL:
{
const EvTbPos *pos = event_params(e, EvTbPos);
EvTbCell *cell = event_result(e, EvTbCell);
switch(pos->col) {
case 0:
cell->align = ekLEFT;
bstd_sprintf(data->temp_string, sizeof(data->temp_string), "Name %d", pos->row);
break;
...
I see - and this works beautifully.
Currently, one may set the alignment of table header columns, for example:
tableview_header_align(collections, id, ekRIGHT);
It is not possible right now to set the same for column data. I suggest it would be natural to allow the data to follow the column header.
This is easily accomplished by changing
tableview.c: i_draw_cell
, linedraw_text_halign(ctx, cell->align);
to read instead
draw_text_halign(ctx, col->align);
I propose that this be done, or a separate function
tableview_column_align(...)
be written.