Added tableSetRowCount.
This commit is contained in:
parent
24790f0e7f
commit
224bdb4087
|
@ -14,6 +14,8 @@ static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
HANDLER(apiHandlers)
|
HANDLER(apiHandlers)
|
||||||
{
|
{
|
||||||
|
intptr_t *rcp;
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_SETFONT:
|
case WM_SETFONT:
|
||||||
// don't free the old font; see http://blogs.msdn.com/b/oldnewthing/archive/2008/09/12/8945692.aspx
|
// 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);
|
addColumn(t, wParam, lParam);
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
return TRUE;
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
// - 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
|
// - checkbox columns don't clip to the column width
|
||||||
// - send standard notification codes
|
// - send standard notification codes
|
||||||
|
// - seriously figure out how we're going to update everything about the table in one place
|
||||||
|
|
||||||
#define tableWindowClass L"gouitable"
|
#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)
|
// 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 {
|
enum {
|
||||||
// wParam - one of the type constants
|
// wParam - one of the type constants
|
||||||
// lParam - column name as a Unicode string
|
// lParam - column name as a Unicode string
|
||||||
tableAddColumn = WM_USER + 20,
|
tableAddColumn = WM_USER + 20,
|
||||||
|
// wParam - 0
|
||||||
|
// lParam - pointer to intptr_t containing new count
|
||||||
|
tableSetRowCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -127,7 +132,6 @@ static const handlerfunc handlers[] = {
|
||||||
|
|
||||||
static void initDummyTableStuff(struct table *t)
|
static void initDummyTableStuff(struct table *t)
|
||||||
{
|
{
|
||||||
t->count = 100;
|
|
||||||
t->selectedRow = 2;
|
t->selectedRow = 2;
|
||||||
t->selectedColumn = 1;
|
t->selectedColumn = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ HBITMAP mkbitmap(void);
|
||||||
|
|
||||||
BOOL mainwinCreate(HWND hwnd, LPCREATESTRUCT lpcs)
|
BOOL mainwinCreate(HWND hwnd, LPCREATESTRUCT lpcs)
|
||||||
{
|
{
|
||||||
|
intptr_t c;
|
||||||
|
|
||||||
tablehwnd = CreateWindowExW(0,
|
tablehwnd = CreateWindowExW(0,
|
||||||
tableWindowClass, L"Main Window",
|
tableWindowClass, L"Main Window",
|
||||||
WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL,
|
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");
|
panic("(test program) error creating lfMessageFont HFONT");
|
||||||
SendMessageW(tablehwnd, WM_SETFONT, (WPARAM) font, TRUE);
|
SendMessageW(tablehwnd, WM_SETFONT, (WPARAM) font, TRUE);
|
||||||
}
|
}
|
||||||
|
c = 100;
|
||||||
|
SendMessageW(tablehwnd, tableSetRowCount, 0, (LPARAM) (&c));
|
||||||
SetFocus(tablehwnd);
|
SetFocus(tablehwnd);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue