guint col;
GType *gtype;
+ GType col_gtype;
g_return_val_if_fail (GDAEX_IS_GRID (grid), NULL);
for (col = 0; col < priv->columns->len; col++)
{
- gtype[col] = gdaex_grid_column_get_gtype ((GdaExGridColumn *)g_ptr_array_index (priv->columns, col));
+ col_gtype = gdaex_grid_column_get_gtype ((GdaExGridColumn *)g_ptr_array_index (priv->columns, col));
+ if (col_gtype == G_TYPE_DATE
+ || col_gtype == G_TYPE_DATE_TIME
+ || col_gtype == GDA_TYPE_TIMESTAMP
+ || ((col_gtype == G_TYPE_INT
+ || col_gtype == G_TYPE_FLOAT
+ || col_gtype == G_TYPE_DOUBLE)
+ && gdaex_grid_column_get_decimals ((GdaExGridColumn *)g_ptr_array_index (priv->columns, col)) > -1))
+ {
+ gtype[col] = G_TYPE_STRING;
+ }
+ else
+ {
+ gtype[col] = col_gtype;
+ }
}
if (priv->model != NULL)
GdaEx *gdaex;
GtkWidget *w;
+ GtkWidget *scrolledw;
GdaExGrid *grid;
GdaExGridColumn *gcol;
}
w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_default_size (GTK_WINDOW (w), 550, 350);
+
+ scrolledw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (w), scrolledw);
grid = gdaex_grid_new ();
- gcol = gdaex_grid_column_new ("ID", "id", G_TYPE_INT, TRUE, FALSE, FALSE, FALSE, 0);
+ gcol = gdaex_grid_column_new ("ID", "id", G_TYPE_INT, TRUE, FALSE, FALSE, FALSE, -1);
+ gdaex_grid_add_column (grid, gcol);
+
+ gcol = gdaex_grid_column_new ("Name", "name", G_TYPE_STRING, TRUE, TRUE, TRUE, TRUE, -1);
gdaex_grid_add_column (grid, gcol);
- gcol = gdaex_grid_column_new ("Name", "name", G_TYPE_STRING, TRUE, TRUE, TRUE, TRUE, 0);
+ gcol = gdaex_grid_column_new ("Surname", "surname", G_TYPE_STRING, TRUE, TRUE, TRUE, TRUE, -1);
gdaex_grid_add_column (grid, gcol);
- gcol = gdaex_grid_column_new ("Surname", "surname", G_TYPE_STRING, TRUE, TRUE, TRUE, TRUE, 0);
+ gcol = gdaex_grid_column_new ("Age", "age", G_TYPE_INT, TRUE, TRUE, TRUE, TRUE, -1);
gdaex_grid_add_column (grid, gcol);
- gcol = gdaex_grid_column_new ("Age", "age", G_TYPE_INT, TRUE, TRUE, TRUE, TRUE, 0);
+ gcol = gdaex_grid_column_new ("Birthday", "birthday", G_TYPE_DATE, TRUE, TRUE, TRUE, TRUE, -1);
gdaex_grid_add_column (grid, gcol);
- gcol = gdaex_grid_column_new ("Birthday", "birthday", G_TYPE_DATE, TRUE, TRUE, TRUE, TRUE, 0);
+ gcol = gdaex_grid_column_new ("Incoming", "incoming", G_TYPE_DOUBLE, TRUE, TRUE, TRUE, TRUE, 2);
gdaex_grid_add_column (grid, gcol);
wgrid = gdaex_grid_get_widget (grid);
- gtk_container_add (GTK_CONTAINER (w), wgrid);
+ gtk_container_add (GTK_CONTAINER (scrolledw), wgrid);
gdaex_grid_fill_from_sql (grid, gdaex, "SELECT * FROM clients", NULL);