Fixed ListView focus issue when switching to the LyricsLayout.

This commit is contained in:
casey langen 2019-04-07 22:20:14 -07:00
parent 839382e2e0
commit 2f6268d7db
2 changed files with 8 additions and 0 deletions

View File

@ -89,6 +89,13 @@ bool LyricsLayout::KeyPress(const std::string& kn) {
return LayoutBase::KeyPress(kn);
}
void LyricsLayout::OnVisibilityChanged(bool visible) {
LayoutBase::OnVisibilityChanged(visible);
if (visible) {
this->FocusFirst();
}
}
void LyricsLayout::LoadLyricsForCurrentTrack() {
auto track = playback.GetPlaying();
if (track && track->GetId() != this->currentTrackId) {

View File

@ -20,6 +20,7 @@ namespace musik { namespace cube {
virtual void OnLayout() override;
virtual void SetShortcutsWindow(cursespp::ShortcutsWindow* w) override;
virtual bool KeyPress(const std::string& kn) override;
virtual void OnVisibilityChanged(bool visible) override;
private:
enum class State: int { NotPlaying, Loading, Loaded, Failed };