Focus username field in login view automatically

This commit is contained in:
Tulir Asokan 2019-04-06 18:03:37 +03:00
parent d0f55f4a6f
commit e9cf38a866
2 changed files with 3 additions and 1 deletions

View File

@ -66,7 +66,7 @@ func (ui *GomuksUI) Init() {
ViewLogin: ui.NewLoginView(),
ViewMain: ui.NewMainView(),
}
ui.app.Root = ui.views[ViewLogin]
ui.SetView(ViewLogin)
}
func (ui *GomuksUI) Start() error {

View File

@ -87,9 +87,11 @@ func (ui *GomuksUI) NewLoginView() mauview.Component {
AddComponent(view.usernameLabel, 1, 1, 1, 1).
AddComponent(view.passwordLabel, 1, 3, 1, 1).
AddComponent(view.homeserverLabel, 1, 5, 1, 1)
view.FocusNextItem()
ui.loginView = view
view.container = mauview.Center(mauview.NewBox(view).SetTitle("Log in to Matrix"), 45, 13)
view.container.SetAlwaysFocusChild(true)
return view.container
}