Based on the info in dbviewer I managed to build an object with the dataview stuff
but without the use of a database.
This was not really an easy task due to the cryptic comments in jdataview.h
and the fact that a lot of functions are not exported.
But I can now insert columns and rows with data and even edit the cells and grab the edited data.
Still some questions remain:
Is there a way to define a type (float, int, text, ...) for a column and thus restrict the input to this type
or do I have to handle this myself?
How is it done in the inspectors?
I thought maybe the values in the following enum could be helpful
but there's no info on what t_jcolumn field would want them?
JCOLUMN_TEXT_ONESYMBOL = 1,
JCOLUMN_TEXT_COMMASEPARATED = 2,
JCOLUMN_TEXT_ICON = 4,
JCOLUMN_TEXT_HASBUTTON = 8,
JCOLUMN_TEXT_FILECHOOSEBUTTON = 16,
JCOLUMN_TEXT_VIEWBUTTON = 32,
JCOLUMN_TEXT_EDITBUTTON = 64,
JCOLUMN_TEXT_TIME = 128,
JCOLUMN_TEXT_FLOAT = 256,
JCOLUMN_TEXT_INT = 512,
JCOLUMN_TEXT_CANTEDIT = 1024,
JCOLUMN_TEXT_FONTSIZE = 2048,
// 4096 is JCOLUMN_DISABLED -- do not use
JCOLUMN_TEXT_FILTERED = 8192
At specific times I send myself the "getcelltext" message to my object in order to get the dataviewer to display the data:
Here is the method called by this message:
void mydataviewer_getcelltext(t_mydataviewer *x, t_symbol *colname, long index, char *text, long maxlen)
t_jdataview *dv = (t_jdataview*)x->d_dataview;
int numcols = dv->d_numcols;
t_max_err err = hashtab_lookup(x->d_columns, colname, (t_object**)&column_index);
int i = ((index-1) * numcols) + (int)column_index;
at = x->data+i;
if(at->a_type == 1)
snprintf_zero(v, maxlen, "%ld", at->a_w.w_long);
else if(at->a_type == 2)
snprintf_zero(v, maxlen, "%f", at->a_w.w_float);
else if(at->a_type == 3)
snprintf_zero(v, maxlen, "%s", at->a_w.w_sym->s_name);
strncpy_zero(text, v, maxlen);
This works fine and the data gets displayed correctly but I get the following error in the Max window:
"missing arguments for message "getcelltext" ".
what would these arguments look like?
Any hints would be helpful.
Thanks so far,