ContentEditValue: Difference between revisions

From TotalcmdWiki
Jump to navigation Jump to search
(Initial document version, backlink & category)
 
(No difference)

Latest revision as of 15:33, 15 April 2017

ContentEditValue allows a plugin to implement a custom input dialog to enter special values like date and time. This function is called in change attributes if you returned the flag contflags_fieldedit in ContentGetSupportedFieldFlags for a field.

Declaration:

int __stdcall ContentEditValue(HWND ParentWin,int FieldIndex,int UnitIndex,int FieldType,

               void* FieldValue,int maxlen,int flags,char* langidentifier);

Description of parameters:

ParentWin The parent window handle for the dialog.

FieldIndex The index of the field for which the content editor is called. This is the same index as the FieldIndex value in ContentGetSupportedField.

UnitIndex The index of the unit used. Example: If the plugin returned the following unit string in ContentGetSupportedField: bytes|kbytes|Mbytes Then a UnitIndex of 0 would mean bytes, 1 means kbytes and 2 means MBytes If no unit string was returned, UnitIndex is 0.

FieldType The type of data passed to the plugin in FieldValue. This is the same type as returned by the plugin via ContentGetSupportedField.

FieldValue Here the plugin receives the data to be edited, and returns the result back to the caller. The data format depends on the field type: ft_numeric_32: FieldValue points to a 32-bit signed integer variable. ft_numeric_64: FieldValue points to a 64-bit signed integer variable. ft_numeric_floating: FieldValue points to a 64-bit floating point variable (ISO standard double precision) ft_date: FieldValue points to a structure containing year,month,day as 2 byte values. ft_time: FieldValue points to a structure containing hour,minute,second as 2 byte values. ft_boolean: Currently unsupported. ft_string: FieldValue is a pointer to a 0-terminated string. ft_multiplechoice: Currently unsupported. ft_fulltext: Currently unsupported. ft_datetime: A timestamp of type FILETIME, as returned e.g. by FindFirstFile(). It is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601. The time MUST be relative to universal time (Greenwich mean time) as returned by the file system, not local time!

maxlen The maximum number of bytes fitting into the FieldValue variable.

flags Currently the following flags are defined: editflags_initialize: The data passed in via FieldValue should be used to initialize the dialog.

langidentifier A 1-3 character language identifier, the same as the last part of the language file name used. Example: The German language file is called wcmd_deu.lng, so the langidentifier is "deu". May be used to translate the dialog.

Return value:

ft_setsuccess User confirmed dialog with OK, and the data is valid ft_nosuchfield The given field index was invalid ft_setcancel The user clicked on cancel

Remarks:

Total Commander already implements an internal editor for the fields ft_date, ft_time, and ft_datetime. You can override it with your own by specifying the contflags_fieldedit flag for your date/time fields. Fields of type boolean and multiple choice do not currently support a field editor.


Back to Content plugins developer guide