aboutsummaryrefslogtreecommitdiff
path: root/c/datalistview.c
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-04-23 13:33:14 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-04-23 13:33:14 +0200
commite4a169261f33557e5e38f3eb79c7ba8ee7603208 (patch)
tree620bd799006d88f99314625dcb88f5ea1e0f8857 /c/datalistview.c
parent49a31841c05f12a2620ed36faf54d1b525704613 (diff)
downloadEpisodeBrowser-e4a169261f33557e5e38f3eb79c7ba8ee7603208.tar.gz
Ensure focused item is visible after DlvShowEpisode.
Diffstat (limited to 'c/datalistview.c')
-rw-r--r--c/datalistview.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/c/datalistview.c b/c/datalistview.c
index 829f6d6..e9ad2ac 100644
--- a/c/datalistview.c
+++ b/c/datalistview.c
@@ -34,9 +34,12 @@ DlvCreate()
void
DlvShowEpisode(int iEpisode)
{
+ int i, iItem;
+ LVFINDINFO lvfi;
LVITEM lviKey, lviValue;
term_t t;
qid_t q;
+ extern HWND HElv;
ListView_DeleteAllItems(HDlv);
@@ -47,7 +50,7 @@ DlvShowEpisode(int iEpisode)
PI(t,iEpisode) return;
q = Q("episode_data","episode_datum",3,t);
- for (int i = 0; Qn(q); i++) {
+ for (i = 0; Qn(q); i++) {
char *szKey;
char *szValue;
TCHAR *tszKey, *tszValue;
@@ -77,4 +80,10 @@ DlvShowEpisode(int iEpisode)
Qc(q);
UpdateLayout();
+
+ lvfi.flags = LVFI_PARAM;
+ lvfi.lParam = iEpisode;
+ iItem = ListView_FindItem(HElv, -1, &lvfi);
+ if (iItem != -1)
+ ListView_EnsureVisible(HElv, iItem, TRUE);
}