CLASS_ATTRIBUTE_STYLE with "file"


    Mar 08 2011 | 11:48 am
    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.

    • Mar 14 2011 | 12:16 pm
      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
    • Mar 14 2011 | 5:23 pm
      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?