Added tableSetRowCount.

This commit is contained in:
Pietro Gagliardi 2015-01-07 22:54:29 -05:00
parent 24790f0e7f
commit 224bdb4087
3 changed files with 18 additions and 1 deletions

View File

@ -14,6 +14,8 @@ static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam)
HANDLER(apiHandlers)
{
intptr_t *rcp;
switch (uMsg) {
case WM_SETFONT:
// don't free the old font; see http://blogs.msdn.com/b/oldnewthing/archive/2008/09/12/8945692.aspx
@ -30,6 +32,13 @@ HANDLER(apiHandlers)
addColumn(t, wParam, lParam);
*lResult = 0;
return TRUE;
case tableSetRowCount:
rcp = (intptr_t *) lParam;
t->count = *rcp;
// TODO refresh table in this way?
updateTableWidth(t);
*lResult = 0;
return TRUE;
}
return FALSE;
}

View File

@ -12,14 +12,19 @@
// - collect all resize-related tasks in a single function (so things like adding columns will refresh everything, not just horizontal scrolls; also would fix initial coordinates)
// - checkbox columns don't clip to the column width
// - send standard notification codes
// - seriously figure out how we're going to update everything about the table in one place
#define tableWindowClass L"gouitable"
// start at WM_USER + 20 just in case for whatever reason we ever get the various dialog manager messages (see also http://blogs.msdn.com/b/oldnewthing/archive/2003/10/21/55384.aspx)
// each of these returns nothing unless otherwise indicated
enum {
// wParam - one of the type constants
// lParam - column name as a Unicode string
tableAddColumn = WM_USER + 20,
// wParam - 0
// lParam - pointer to intptr_t containing new count
tableSetRowCount,
};
enum {
@ -127,7 +132,6 @@ static const handlerfunc handlers[] = {
static void initDummyTableStuff(struct table *t)
{
t->count = 100;
t->selectedRow = 2;
t->selectedColumn = 1;
}

View File

@ -12,6 +12,8 @@ HBITMAP mkbitmap(void);
BOOL mainwinCreate(HWND hwnd, LPCREATESTRUCT lpcs)
{
intptr_t c;
tablehwnd = CreateWindowExW(0,
tableWindowClass, L"Main Window",
WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL,
@ -36,6 +38,8 @@ BOOL mainwinCreate(HWND hwnd, LPCREATESTRUCT lpcs)
panic("(test program) error creating lfMessageFont HFONT");
SendMessageW(tablehwnd, WM_SETFONT, (WPARAM) font, TRUE);
}
c = 100;
SendMessageW(tablehwnd, tableSetRowCount, 0, (LPARAM) (&c));
SetFocus(tablehwnd);
return TRUE;
}