Applies to: the ABC file lookup control template; posted in the Clarion 6 group, no version named.
Problem
Hand-coded, FILEDIALOG gives a return value: IF FileDialog(...) has a branch for "they selected a file" and an ELSE for cancel. The template puts code in about fifteen places and the poster could not find a return value to test. The poster also asked the difference between FileLookup4.Ask(1) and FileLookup4.Ask(0); the thread did not answer that.
Solution
- Give the template a variable in the second parameter of the lookup. If the variable has a value afterwards, the user made a selection; if it is empty, the user cancelled. Reaching the ELSE branch means cancelled.
- The template does not clear the variable first. If it held an old value from an earlier lookup, a cancel still looks like a selection. The original poster cleared the variable by hand before each lookup and then had it working.
- Check the template's "Return Default on Cancel" box. With it ticked a cancel looks like a selection. The original poster said this helped, together with a default value he had set oddly.
Caveats
- Clearing the variable before the lookup is the poster's own addition, not part of the template.
- The difference between Ask(1) and Ask(0) was not settled.
Today (2026)
Likely still true for the ABC FileLookup class. Not re-tested.
Sources: Andy M. (Jan 2010, the question), Steven P. (Jan 2010), Carl S. (Jan 2010) in softvelocity.public.clarion6.