Changed from recomputeHScroll() to updateTableWidth() as we will store the table width separately and just use one call to SetScrollInfo() for everything to avoid weirdness.

This commit is contained in:
Pietro Gagliardi 2014-12-10 10:01:16 -05:00
parent cb199cca77
commit a8fed6c28d
3 changed files with 8 additions and 4 deletions

View File

@ -9,7 +9,7 @@ static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam)
if (t->columnTypes[t->nColumns - 1] >= nTableColumnTypes) if (t->columnTypes[t->nColumns - 1] >= nTableColumnTypes)
panic("invalid column type passed to tableAddColumn"); panic("invalid column type passed to tableAddColumn");
headerAddColumn(t, (WCHAR *) lParam); headerAddColumn(t, (WCHAR *) lParam);
recomputeHScroll(t); updateTableWidth(t);
} }
HANDLER(apiHandlers) HANDLER(apiHandlers)

View File

@ -53,6 +53,11 @@ static void headerAddColumn(struct table *t, WCHAR *name)
panic("error adding column to Table header"); panic("error adding column to Table header");
} }
static void updateTableWidth(struct table *t)
{
recomputeHScroll(t);
}
HANDLER(headerNotifyHandler) HANDLER(headerNotifyHandler)
{ {
NMHDR *nmhdr = (NMHDR *) lParam; NMHDR *nmhdr = (NMHDR *) lParam;
@ -61,8 +66,7 @@ HANDLER(headerNotifyHandler)
return FALSE; return FALSE;
if (nmhdr->code != HDN_ITEMCHANGED) if (nmhdr->code != HDN_ITEMCHANGED)
return FALSE; return FALSE;
// TODO should this be last? updateTableWidth(t);
recomputeHScroll(t);
// TODO make more intelligent // TODO make more intelligent
InvalidateRect(t->hwnd, NULL, TRUE); InvalidateRect(t->hwnd, NULL, TRUE);
// TODO UpdateWindow()? // TODO UpdateWindow()?

View File

@ -14,7 +14,7 @@ HANDLER(resizeHandler)
if ((wp->flags & SWP_NOSIZE) != 0) if ((wp->flags & SWP_NOSIZE) != 0)
return FALSE; return FALSE;
repositionHeader(t); repositionHeader(t);
recomputeHScroll(t); updateTableWidth(t);
*lResult = 0; *lResult = 0;
return TRUE; return TRUE;
} }