[Solved] WFX with custom fields - unknown problem, need help
Moderators: Hacker, petermad, Stefan2, white
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel
[Solved] WFX with custom fields - unknown problem, need help
Hello to all.
I'm developing a WFX plugin.
All worked well until I've decided to add some custom fields. I've programmed FsContentGetSupportedField and FsContentGetValue functions only.
When the plugin in standard columns mode, all is OK. But if I define any custom fields set (even Name-Type fields only), and switch plugin to use it, there are some problem: plugin cannod build file list.
I've traced FsFindFirst/FsFindNext execution, but all looks OK, except error sound after file list build completion. After that sound panel is almost empty, except some file icons and some files shown. Under cursor file icon is shown always with some strange details: if I move cursor to new position by keyboard, the icon appears in the new position; if I move cursor to new position by mouse, the icon appears in the previous position of cursor. And when I try to scroll files by keyboard up and down (especially by PgUp/PgDn), there is an error sound again.
What I must search for to fix this unbelievable behaviour?
P.S. Plugin is testing now in TC 8.0b4
I'm developing a WFX plugin.
All worked well until I've decided to add some custom fields. I've programmed FsContentGetSupportedField and FsContentGetValue functions only.
When the plugin in standard columns mode, all is OK. But if I define any custom fields set (even Name-Type fields only), and switch plugin to use it, there are some problem: plugin cannod build file list.
I've traced FsFindFirst/FsFindNext execution, but all looks OK, except error sound after file list build completion. After that sound panel is almost empty, except some file icons and some files shown. Under cursor file icon is shown always with some strange details: if I move cursor to new position by keyboard, the icon appears in the new position; if I move cursor to new position by mouse, the icon appears in the previous position of cursor. And when I try to scroll files by keyboard up and down (especially by PgUp/PgDn), there is an error sound again.
What I must search for to fix this unbelievable behaviour?
P.S. Plugin is testing now in TC 8.0b4
Last edited by Korney San on 2011-10-28, 10:34 UTC, edited 1 time in total.
Praemonitus praemunitus
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel
The joke is that FsContentGetValue has some debug messageboxes and they fired only for files randomly passed that crazy "filter" (I mean only for files that shown in custom view).MVV wrote:Maybe TC calls FsContentGetValue after each call to FsFindNext and some exception occurs?
UPD:
One more detail: file names are shown in status bar even if they are not shown in the list.

Praemonitus praemunitus
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It may be because of the alternate text which you can return in the numeric_floating field. From the help:
ft_numeric_floating: You can now put a 0-terminated string immediately behind the 64bit floating point variable, which will then be shown instead in file lists. This is useful if the conversion precision used by TC isn't appropriate for your variables. The numeric variable will still be used for sorting and searching. If the string is empty, TC will ignore it (it is set to 0 before calling this function, so the function will remain backwards-compatible). Example: The numeric value is 0.000002. You can return this value as a 64-bit variable, and the string you find most appropriate, e.g. "2*10^-6" or "0.000002".
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel
Er... I don't want to consider myself a stupid, but what FieldValue must point to? PChar, Integer, Double or what?ghisler(Author) wrote:ft_numeric_floating: You can now put a 0-terminated string immediately behind the 64bit floating point variable, which will then be shown instead in file lists. This is useful if the conversion precision used by TC isn't appropriate for your variables. The numeric variable will still be used for sorting and searching. If the string is empty, TC will ignore it (it is set to 0 before calling this function, so the function will remain backwards-compatible). Example: The numeric value is 0.000002. You can return this value as a 64-bit variable, and the string you find most appropriate, e.g. "2*10^-6" or "0.000002".
Praemonitus praemunitus
You should write your number into first 8 bytes of that buffer (Double), and immediately after theese bytes you may write null-terminating string. E.g. buffer:
First 8 bytes represent number 0.000002, and next 8 bytes represent string "2*10^-6" with terminating zero byte. You may just leave zero byte after number if you don't need to pass string representation:
(as Christian said, 9th byte of that buffer is already zero when TC calls plugin function so you may just copy number to first 8 bytes)
So, you may think that FieldValue points to record number: Double; str: array [0..n] of char end.
Code: Select all
8DEDB5A0F7C6C03E322A31305E2D3600
Code: Select all
8DEDB5A0F7C6C03E00
So, you may think that FieldValue points to record number: Double; str: array [0..n] of char end.
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel
"As I said before, I don't like to repeat!" (c)MVV wrote:You may try to return ft_fieldempty just at the beginning of ContentGetValue to check if other places have errors.
This function isn't called when custom columns are Name and Ext only.
Combine link and see shots.
dl.
dropbox.
com/
u/
936057/
BugsPics/
Normal view (without custom columns):
Image%20052%201.png
Name and Ext columns only (no icons&names on some files):
Image%20053%201.png
Cursor moving by keyboard (see file name in status bar):
Image%20054%201.png
Filename can be "edited":
Image%20055%201.png
Any suggestions?
P.S. (untranslated strong) Я заколебался ставить трассирующие сообщения в разных местах, но они показывают, что "всё нормально@всё работает...
Praemonitus praemunitus
Here clickable links from post above:
Korney San, maybe you can provide test version of plugin for Christian?Normal view (without custom columns):
http://dl.dropbox.com/u/936057/BugsPics/Image%20052%201.png
Name and Ext columns only (no icons&names on some files):
http://dl.dropbox.com/u/936057/BugsPics/Image%20053%201.png
Cursor moving by keyboard (see file name in status bar):
http://dl.dropbox.com/u/936057/BugsPics/Image%20054%201.png
Filename can be "edited":
http://dl.dropbox.com/u/936057/BugsPics/Image%20055%201.png
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel
No problem!MVV wrote:Korney San, maybe you can provide test version of plugin for Christian?
Here is an archive containing:
- compiled stub version of plugin (no external data source required, it's emulated by file, all actions are disabled)
- text file with emulated data (required to be in plugin folder for correct emulation)
- sources of plugin (Delphi 7).
P.S. Hehe, one-day-limit was reached...

Praemonitus praemunitus
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
- Korney San
- Junior Member
- Posts: 19
- Joined: 2011-10-13, 11:42 UTC
- Location: Belarus, Gomel