Set channels List title when guild is selected

This commit is contained in:
rigormorrtiss 2021-07-28 19:48:20 +04:00
parent a9ea2244f5
commit 0bd48686cb
2 changed files with 5 additions and 5 deletions

View file

@ -167,12 +167,14 @@ func onGuildsDropDownSelected(text string, _ int) {
}
}
channelsList.SetTitle("Channels")
app.SetFocus(channelsList)
for i := range currentGuild.Channels {
channel := currentGuild.Channels[i]
channelsList.AddItem(channel.Name, "", 0, nil)
}
app.SetFocus(channelsList)
}
func onChannelsListSelected(i int, mainText string, secondaryText string, _ rune) {
@ -183,11 +185,10 @@ func onChannelsListSelected(i int, mainText string, secondaryText string, _ rune
mainFlex.AddItem(messageInputField, 3, 1, false)
}
app.SetFocus(messageInputField)
currentChannel = currentGuild.Channels[i]
messagesTextView.SetTitle(currentChannel.Name)
app.SetFocus(messageInputField)
messages := util.GetMessages(session, currentChannel.ID, 50)
for i := len(messages) - 1; i >= 0; i-- {

View file

@ -14,8 +14,7 @@ func NewChannelsList(onChannelsListSelected func(i int, mainText string, seconda
SetSelectedFunc(onChannelsListSelected)
channelsList.
SetBorder(true).
SetBorderPadding(0, 0, 1, 1).
SetTitle("Channels")
SetBorderPadding(0, 0, 1, 1)
return
}