TOpenDialog, TSaveDialog and TSavePictureDialog report wrong FilterIndex
Original Reporter info from Mantis: jwdietrich @jwdietrich21
-
Reporter name: Johannes W. Dietrich
Original Reporter info from Mantis: jwdietrich @jwdietrich21
- Reporter name: Johannes W. Dietrich
Description:
TOpenDialog, TSaveDialog and TSavePictureDialog report a FilterIndex that is too high. If a FilterIndex is assigned, it is correctly set in the resulting dialog box, but retrieving it after e.g. OpenDialog.Execute delivers a value that is increased by 1.
Of course this can be circumnavigated by writing:
var
theFilterIndex: integer;
begin
OpenDialog1.FilterIndex := 2;
if OpenDialog1.Execute then
begin
theFileName := OpenDialog1.FileName;
theFilterIndex := OpenDialog1.FilterIndex;
{$IFDEF LCLcarbon} {compensates for a bug in the carbon widgetset}
theFilterIndex := theFilterIndex + 1;
{$ENDIF} {may be removed in future versions}
case theFilterIndex of
0: DoSomething
1: DoSomethingDifferent;
end;
end;
end;
but the behaviour of the widgetset is not expected and it would be preferable to have the same indices on all platforms.
Mantis conversion info:
- Mantis ID: 22846
- Version: 1.0.0
- Monitored by: » @jwdietrich21 (Johannes W. Dietrich)