Closed MostHated closed 5 years ago
Getting closer. It took me long than it should have to realize that OnDrawCell seems like it does each cell individually, which would explain why all of them changed when I tried to do something with it. I simplified it down to about as basic as it could be.
I implemented a small new function:
func (d *dbCache) NewValue(row, col int, newText string) {
d.data[row][col] = newText
}
Then did:
dlg.OnClose(func() {
switch dlg.Result() {
case ui.DialogButton1:
newText := dlg.EditResult()
cache.NewValue(c, r, newText)
ui.PutEvent(ui.Event{Type: ui.EventRedraw})
}
})
It writes back, but it seems to shift columns. Definitely much closer than I was, though.
I got it. I had col and row mixed up in the new value >_<
Thanks again for the info on editing the data table, it worked out great when I tried it in a small demo I put together to try things out.
I also wanted to try and use the cached one in the demo and I was able to almost get it working, but I am missing something when trying to write the value back. I can get the data just fine so it displays when you hit F2/Enter to edit the field, but when you try to apply it I was able to get it so every field all changed at once, or no fields changed at all. So, I guess I am stuck somewhat in the middle, lol.
Are you able to spot what I might have been doing wrong? I tried to comment a few of the different things I have tried, but over the afternoon I have tried so many things that what's there probably doesn't even make sense anymore, lol. as Thanks! -MH