[Solved] WFX with custom fields - unknown problem, need help

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

[Solved] WFX with custom fields - unknown problem, need help

Post by *Korney San »

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
Last edited by Korney San on 2011-10-28, 10:34 UTC, edited 1 time in total.
Praemonitus praemunitus
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Maybe TC calls FsContentGetValue after each call to FsFindNext and some exception occurs?
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

MVV wrote:Maybe TC calls FsContentGetValue after each call to FsFindNext and some exception occurs?
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).

UPD:
One more detail: file names are shown in status bar even if they are not shown in the list. :shock:
Praemonitus praemunitus
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

What field type did you try to return?
Author of Total Commander
https://www.ghisler.com
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

ghisler(Author) wrote:What field type did you try to return?
ft_numeric_64 for zero value, ft_numeric_floating otherwise.

Cannot post a screencut due to forum limitations. :)
Praemonitus praemunitus
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

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
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

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".
Er... I don't want to consider myself a stupid, but what FieldValue must point to? PChar, Integer, Double or what?
Praemonitus praemunitus
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

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:

Code: Select all

8DEDB5A0F7C6C03E322A31305E2D3600
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:

Code: Select all

8DEDB5A0F7C6C03E00
(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.
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

I think the problem is somewhere else, because it exists even if custom columns set to Name-Ext (FsContentGetValue is NEVER called).
Praemonitus praemunitus
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You may try to return ft_fieldempty just at the beginning of ContentGetValue to check if other places have errors.
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

MVV wrote:You may try to return ft_fieldempty just at the beginning of ContentGetValue to check if other places have errors.
"As I said before, I don't like to repeat!" (c)
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
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Here clickable links from post above:
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, maybe you can provide test version of plugin for Christian?
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

MVV wrote:Korney San, maybe you can provide test version of plugin for Christian?
No problem!
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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50479
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks, I will have a look at it.
Author of Total Commander
https://www.ghisler.com
User avatar
Korney San
Junior Member
Junior Member
Posts: 19
Joined: 2011-10-13, 11:42 UTC
Location: Belarus, Gomel

Post by *Korney San »

TC 8.0b5 - the same thing. Is there any error in my code?
Praemonitus praemunitus
Post Reply