From 7457f0dcafa3d9f82acb9d1e802daa45ec917415 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Fri, 10 Dec 2010 07:49:22 +0000 Subject: Added table-spreadsheet example. Various example mods. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7994 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- examples/table-simple.cxx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'examples/table-simple.cxx') diff --git a/examples/table-simple.cxx b/examples/table-simple.cxx index 63c62b854..4db51b468 100644 --- a/examples/table-simple.cxx +++ b/examples/table-simple.cxx @@ -30,14 +30,17 @@ // http://www.fltk.org/str.php // #include -#include +#include #include #include +#define MAX_ROWS 30 +#define MAX_COLS 30 + // Derive a class from Fl_Table class MyTable : public Fl_Table { - int data[10][10]; // our 10x10 data array + int data[MAX_ROWS][MAX_COLS]; // data array for cells // Draw the row/col headings // Make this a dark thin upbox with the text inside. @@ -57,7 +60,7 @@ class MyTable : public Fl_Table { // Draw cell bg fl_color(FL_WHITE); fl_rectf(X,Y,W,H); // Draw cell data - fl_color(FL_DARK3); fl_draw(s, X,Y,W,H, FL_ALIGN_CENTER); + fl_color(FL_GRAY0); fl_draw(s, X,Y,W,H, FL_ALIGN_CENTER); // Draw box border fl_color(color()); fl_rect(X,Y,W,H); fl_pop_clip(); @@ -94,16 +97,16 @@ public: // MyTable(int X, int Y, int W, int H, const char *L=0) : Fl_Table(X,Y,W,H,L) { // Fill data array - for ( int x=0; x<10; x++ ) - for ( int y=0; y<10; y++ ) - data[x][y] = 1000+x*1000+y; + for ( int r=0; r