-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing: Information trees #141
Comments
You could either use We do have an ongoing PR somewhere to add a |
I have been able to successfully use those structs you mentioned above to build flat lists. However, I've been looking at building trees, displaying trees. Which it would look like a developer would need to use a tree model. It is both this tree model and the TreeListModelCreateModelFunc that expose item *coreglib.Object that I can't figure out how to turn into my model like I was able to with the gioutil.ListModel[T]. |
You could see how Dissent does it: https://github.com/diamondburned/dissent/blob/main/internal/sidebar/channels/channels_model.go It still uses the legacy |
I think this is where I'm stuck, looking at your code here you're casting the item to a *gtk.StringObject. I have a non-gtk struct that I need to cast to, and I get an error. So is it not possible to bring our own types to the TreeModel at this point? |
If you're using You can get additional type safety by using var goModelType = gioutil.NewListModelType[goModel]()
var gtkModel = goModelType.New()
var goValue = goModelType.ObjectValue(obj) |
Thank you. I'll give that a try. I'm curious, is there a way to update the rows that contain in the list views? I've seen some GTK forums discussing bound properties, but in go we don't have bound properties like someone in C would have, unless I'm missing something. |
What do you mean? Each row in the list view should reflect data from some Go model, so to change that data, you'd just change the data in the model. The way you're supposed to use |
I suppose I'm just trying to figure out the listmodel/listview combo and the ins and outs. I have a ListModel, that displays a label. I updated the value that gets set on the label in my go struct, but I'm unsure how to get the bind to happen again. Perhaps it is a mater of me needing to learn more of the specifics. |
You will probably have to var n int
var v Value
list.Splice(n, 1, v) A |
(You can consider each item in the |
OK, that makes sense. I did see the splice method. Is there an availability to splice with a TreeListModel? |
You'd splice one of the relevant list models within the tree model and the change will automatically propagate to the entire tree. |
I think I could have asked a better question. How do I find and access the underlying ListModel from the tree model? I have the root ListModel saved, but I haven't seen any API for accessing child ListModels. |
You'd probably use |
I've been working on migrating TreeViews to ListViews with TreeListModels. I'm finding though that there is a lack of information of how to accomplish this. Specifically with regards to TreeListModelCreateModelFunc on the NewTreeListModel. How do I properly use the item *coreglib.Object to know what child listmodel I need to return?
The text was updated successfully, but these errors were encountered: