February 2019
Intermediate to advanced
450 pages
11h 59m
English
Most of the work for our email list was done in the preceding model code—now we need to connect it to the user interface. The following code sets up a walk.TreeView class that we use to keep track of the current item and assigns it to the declarative TreeView. After that, the model is set and then we pass a function that will be informed when the current item changes:
emailList *walk.TreeViewTreeView{ AssignTo: &g.emailList, Model: model, OnCurrentItemChanged: func() { item := g.emailList.CurrentItem() if email, ok := item.(*EmailModel); ok { g.SetMessage(email.email) } },},
With all that in place, the application will load the email details from the current email message using model.Server.CurrentMessage() via the default DataSource ...
Read now
Unlock full access