ContentGetSupportedFieldFlags

From TotalcmdWiki
Revision as of 15:29, 15 April 2017 by Lefteous (talk | contribs) (Initial document version, backlink & category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ContentGetSupportedFieldFlags is called to get various information about a plugin variable. It's first called with FieldIndex=-1 to find out whether the plugin supports any special flags at all, and then for each field separately.

Declaration:

int __stdcall ContentGetSupportedFieldFlags(int FieldIndex);

Description of parameters:

FieldIndex The index of the field for which flags should be returned. -1: Return a combination (or) of all supported flags, e.g. contflags_edit | contflags_substmask >=0: Return the field-specific flags

Return value:

The function needs to return a combination of the following flags:

contflags_edit The plugin allows to edit (modify) this field via Files - Change attributes. This should only be returned for fields where it makes sense, e.g. a file date.

Only ONE of the following flags: (See description and example under "Note"). contflags_substsize use the file size contflags_substdatetime use the file date+time (ft_datetime) contflags_substdate use the file date (fd_date) contflags_substtime use the file time (fd_time) contflags_substattributes use the file attributes (numeric) contflags_substattributestr use the file attribute string in form -a-- contflags_passthrough_size_float pass the size as ft_numeric_floating to ContentGetValue. The plugin will then apply the correct units, and return the formatted display string in the additional string field. contflags_substmask A combination of all above substitution flags. Should be returned for index -1 if the content plugin contains ANY of the substituted fields. contflags_fieldedit If set, TC will show a button >> in change attributes which lets the user call the function ContentEditValue. This allows plugins to have their own field editors, like the custom editor for tc.comments or tc.*date/time fields.


Note:

Returning one of the contflags_subst* flags instructs Total Commander to replace (substitute) the returned variable by the indicated default internal value if no plugin variable can be retrieved. Example: Content plugins do not work on FTP servers. A field which shows the size of files and directories should be replaced by the size of the FTP files in this case, so return contflags_substsize. Alternatvely, you can also return contflags_passthrough_size_float - then Total Commander will call ContentGetValue and pass the size as ft_numeric_floating to your plugin, so you can format the display string yourself, and apply custom units.


Back to Content plugins developer guide