Page 1 of 1

richviewAction.open without knowing the filterindex

Posted: Tue May 24, 2016 5:18 pm
by wandogau
Hello,
I want to load a file via command line - using RichViewActions.
code:
...
actionOpen1.loadFile (rve, filename, ...)
What filter-Index should I take?
Okay, it's easy:
ext := UpperCase (ExtractFileExt (filename);)
if ext = '.RTF' then
fIndex := 1
...
but, is there an easier way?

Best regards
Marco (wandogau)

Posted: Tue May 24, 2016 7:50 pm
by Sergey Tkachenko
Sorry, no. You need to check extensions.
However, you should calculate not CustomFilterIndex parameter, but FileFormat:
if ext = '.RTF' then
FileFormat := ffiRTF
...

CustomFilterIndex is used only if you implemented opening files in your own formats.

Posted: Wed May 25, 2016 12:39 pm
by wandogau
Hello,
okay - done. Will publish the code snipped in private Forum.
Best regards
Marco (wandogau)