cogentcore / core

A free and open source framework for building powerful, fast, and elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the Web with a single pure Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.31k stars 71 forks source link

TableView can not set struct #938

Closed ddkwork closed 3 months ago

ddkwork commented 3 months ago

Describe the bug

see title

How to reproduce

go run https://github.com/cogentcore/cogent/blob/main/ai%2Fai.go#L47-L47

Example code

No response

Relevant output

No response

Platform

Windows

kkoreilly commented 3 months ago

A TableView is designed to represent a slice of structs, not a single struct. If you want to represent a single struct, use a StructView. If you want to initialize the TableView with one struct, make a slice (SetSlice(&[]Model{ModelJSON})).

ddkwork commented 3 months ago

Ok, the main functions have been completed, and the others are doc, about, etc., which can be done in the later stage. Now the main thing is that the interface is not ideal, I hope you will make it beautiful as soon as possible

---Original--- From: @.> Date: Mon, Mar 18, 2024 01:50 AM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] TableView can not set struct (Issue #938)

A TableView is designed to represent a slice of structs, not a single struct. If you want to represent a single struct, use a StructView. If you want to initialize the TableView with one struct, make a slice (SetSlice(&[]Model{ModelJSON})).

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kkoreilly commented 3 months ago

I will work on improving the interface as soon as I have time.

kkoreilly commented 3 months ago

Can you try to pull before you make changes and not overwrite my changes when there is a merge conflict? You accidentally got rid of some changes I made earlier today. Thanks!

ddkwork commented 3 months ago

I'm sorry, this morning I merged the commit like this: fetch xxx I chose to merge instead of rebase, at this point goland doesn't show any conflicting prompts, can you tell me that the changes to the ai directory are missing? or other directories

---Original--- From: @.> Date: Mon, Mar 18, 2024 04:50 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] TableView can not set struct (Issue #938)

Can you try to pull before you make changes and not overwrite my changes when there is a merge conflict? You accidentally got rid of some changes I made earlier today. Thanks!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

kkoreilly commented 3 months ago

No worries, I was able to finish and reapply my changes later; just make sure to pull and rebase in the future.

ddkwork commented 3 months ago

To make sure of this, when I update your commit, I should check your commit first, and then rebase it every time after that, so that your changes should be refreshed regardless of whether Goland prompts me to merge or rebase. I think it's a viable option, don't you think? It's puzzling that Goland didn't detect the conflict

---Original--- From: @.> Date: Mon, Mar 18, 2024 07:26 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] TableView can not set struct (Issue #938)

No worries, I was able to finish and reapply my changes later; just make sure to pull and rebase in the future.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

kkoreilly commented 3 months ago

Yep, you should always pull and rebase when possible.