CLASS_ATTRIBUTE_STYLE with "file"

Peter Castine's icon

Is there any sample code for using the CLASS_ATTRIBUTE_STYLE macros with the style "file"?

I've grepped & eyballed the sample code without any luck.

All I want to store in my object is a Symbol* that points to the file name. No information about path or file pointers (the file's supposed to be in the search path). But it might be nifty if I could get the little "Choose…" button in my inspector.

tap's icon

Here is how it is done in the fpic object:

    CLASS_ATTR_SYM(c,"pic",0,t_jfpic,j_sym);
    CLASS_ATTR_ACCESSORS(c,"pic",NULL,jfpic_setattr_pict);
    CLASS_ATTR_DEFAULT_SAVE_PAINT(c,"pic",0,"");
    CLASS_ATTR_STYLE_LABEL(c, "pic", 0, "imagefile", "Image File");

Cheers,
Tim

Peter Castine's icon

Thanks, that gets me started. So, basically, a custom setter is the key. Nice to know about the style "imagefile".

I don't suppose there is a way to specify only .PNG files to the file chooser dialog?