neroist / uing

A fork of ui that wraps libui-ng instead of libui

Home Page:https://uing.nim.town

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table

Sznymo opened this issue · comments

commented

I have a question how to get the value of a row from an example with a table?
I have a question about the record. After clicking on the text "row 0 x col 1", it is not possible to save the change.
I see a lot of errors in the console
"GLib-GObject-CRITICAL**: 14:53:13.278: g_value_get_boxed: assertion 'G_VALUE_HOLDS_BOXED (value)' failed"

commented

I see a lot of errors in the console
"GLib-GObject-CRITICAL**: 14:53:13.278: g_value_get_boxed: assertion 'G_VALUE_HOLDS_BOXED (value)' failed"

This is even an issue in the original ui library, and I dont know what's causing it. It's not an issue with libui-ng, but even if i remake the example using rawui that problem still persists... Its most likely a problem with the example. I'll look into it.

I have a question about the record. After clicking on the text "row 0 x col 1", it is not possible to save the change.

This is because in modelCellValue and modelSetCellValue the changes you make aren't saved and returned in modelCellValue. To save your changes I assume you would have to have some state you modify in modelSetCellValue and return in modelCellValue. This isn't in the example.

I have a question how to get the value of a row from an example with a table?

I don't think libui-ng offers the ability to get the value of a row. Since you already have the value since you return it in cellValue method in your TableModelHandler you should use that instead.

commented

Nevermind, the errors were caused by TableParams.rowBackgroundColorModelColumn not being set to -1.

commented

I don't quite understand how to use the TableModelHandler to get the row value :/ could you explain it to me?

commented

You don't really get the cell value in TableModelHandler but you return the value you intend to display in the table in the TableModelHandler.cellValue method.

If you need to retrieve the cell value its possible to call your cellValue method manually.

For example this code when inserted into table.nim:

let x = modelCellValue(addr mh, p.model, 1, 3) # or mh.cellValue(addr mh, p.model, 1, 3) 
var v: TableValue
new v
v.impl = x
echo v

would print "row 1 x col 3" in the terminal.

commented

Thank you, thank you, thank you :D
You are awesome @neroist

commented

You're welcome @Sznymo !

commented

What can cause this?
"Error: illegal capture 'NUM_ROWS' because 'modelNumRows' has the calling convention: "

commented

What can cause this? "Error: illegal capture 'NUM_ROWS' because 'modelNumRows' has the calling convention: "

I did not see this, I am so sorry, but if you are still having this issue please elaborate and show the full error.