Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-06

DefaultExt and Filter priority.

12 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Zaher Dirkey

Hi Lazarus team,

I know it is not Delphi compatibility.

In OpenDialogs or SaveDialog if i set DefaultExt value and execute, and type file name without an extension, the file name return with the extension from the first extension in the filter.

1 - DefaultExt not work until filter is empty
2 - DefaultExt is nonsense if the Filter is set

Most programmers set the filter except the newbie ones, then mostly DefaultExt is nonsense.

My problem is my project collect the filter from the plugins, i can't sort it manually to put the default extension to the first, DefaultExt come not useful for me.

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120616/17f21e90/attachment.html>

Reply by email

Mattias Gaertner
to Zaher Dirkey
Show quoted text 17 lines
Hi Lazarus team, I know it is not Delphi compatibility. In OpenDialogs or SaveDialog if i set DefaultExt value and execute, and type file name without an extension, the file name return with the extension from the first extension in the filter. 1 - DefaultExt not work until filter is empty 2 - DefaultExt is nonsense if the Filter is set Most programmers set the filter except the newbie ones, then mostly DefaultExt is nonsense. My problem is my project collect the filter from the plugins, i can't sort it manually to put the default extension to the first, DefaultExt come not useful for me.

How does the user of your application know the default extension?

Mattias

Reply by email

Zaher Dirkey
to Mattias Gaertner

On Sat, Jun 16, 2012 at 11:37 AM, Mattias Gaertner <

Show quoted text 31 lines
wrote: On Sat, 16 Jun 2012 11:29:34 +0300 Zaher Dirkey wrote: > Hi Lazarus team, > > I know it is not Delphi compatibility. > > In OpenDialogs or SaveDialog if i set DefaultExt value and execute, and > type file name without an extension, the file name return with the > extension from the first extension in the filter. > > 1 - DefaultExt not work until filter is empty > 2 - DefaultExt is nonsense if the Filter is set > > Most programmers set the filter except the newbie ones, then mostly > DefaultExt is nonsense. > > My problem is my project collect the filter from the plugins, i can't sort > it manually to put the default extension to the first, DefaultExt come not > useful for me. How does the user of your application know the default extension? Mattias

For example, my project is an editor for multitype files, PAS, LFM, SQL now the default is PAS and it is the first extension, not problem the user open SQL file, now he make SaveAs and type new name without extension, here the dialog return it as PAS extension.

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120616/a87f0490/attachment.html>

Reply by email

Mattias Gaertner
to Zaher Dirkey
Show quoted text 36 lines
On Sat, Jun 16, 2012 at 11:37 AM, Mattias Gaertner < > wrote: > On Sat, 16 Jun 2012 11:29:34 +0300 > Zaher Dirkey wrote: > > > Hi Lazarus team, > > > > I know it is not Delphi compatibility. > > > > In OpenDialogs or SaveDialog if i set DefaultExt value and execute, and > > type file name without an extension, the file name return with the > > extension from the first extension in the filter. > > > > 1 - DefaultExt not work until filter is empty > > 2 - DefaultExt is nonsense if the Filter is set > > > > Most programmers set the filter except the newbie ones, then mostly > > DefaultExt is nonsense. > > > > My problem is my project collect the filter from the plugins, i can't > sort > > it manually to put the default extension to the first, DefaultExt come > not > > useful for me. > > How does the user of your application know the default > extension? > > Mattias > > For example, my project is an editor for multitype files, PAS, LFM, SQL now the default is PAS and it is the first extension, not problem the user open SQL file, now he make SaveAs and type new name without extension, here the dialog return it as PAS extension.

On "save as" of a SQL file I would expect that the selected filter is the filter for SQL files.
In that case TFileDialog adds ".sql".
If the user selects a different filter, say .txt, then TFileDialog adds ".txt".
AFAIK MS Office and Open Office do it the same.

Mattias

Reply by email

Zaher Dirkey
to Mattias Gaertner

On Sat, Jun 16, 2012 at 7:13 PM, Mattias Gaertner <

Show quoted text 53 lines
wrote: On Sat, 16 Jun 2012 12:20:48 +0300 Zaher Dirkey wrote: > On Sat, Jun 16, 2012 at 11:37 AM, Mattias Gaertner < > > wrote: > > > On Sat, 16 Jun 2012 11:29:34 +0300 > > Zaher Dirkey wrote: > > > > > Hi Lazarus team, > > > > > > I know it is not Delphi compatibility. > > > > > > In OpenDialogs or SaveDialog if i set DefaultExt value and execute, and > > > type file name without an extension, the file name return with the > > > extension from the first extension in the filter. > > > > > > 1 - DefaultExt not work until filter is empty > > > 2 - DefaultExt is nonsense if the Filter is set > > > > > > Most programmers set the filter except the newbie ones, then mostly > > > DefaultExt is nonsense. > > > > > > My problem is my project collect the filter from the plugins, i can't > > sort > > > it manually to put the default extension to the first, DefaultExt come > > not > > > useful for me. > > > > How does the user of your application know the default > > extension? > > > > Mattias > > > > > For example, my project is an editor for multitype files, PAS, LFM, SQL > now the default is PAS and it is the first extension, not problem > the user open SQL file, now he make SaveAs and type new name without > extension, here the dialog return it as PAS extension. On "save as" of a SQL file I would expect that the selected filter is the filter for SQL files. In that case TFileDialog adds ".sql". If the user selects a different filter, say .txt, then TFileDialog adds ".txt". AFAIK MS Office and Open Office do it the same.

Thanks, I understand now, i fixed it by change the order of filter.

The real problem happened when we have same filter like in Lazarus (*.pas, *.pp, *.inc) and if we set the DefaultExt to .pp it will return .pas as the first filter extension, but i think Lazarus fix it manual, for me i changed the order depend on the current file opened, i moved the extension to the first.

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120616/154b8b32/attachment.html>

Reply by email

Bart
to Zaher Dirkey: On Sat, Jun 16, 2012 at 11:37 AM, Mattias Gaertner < For example, my project is an editor…
Zaher Dirkey wrote
For example, my project is an editor for multitype files, PAS, LFM, SQL now the default is PAS and it is the first extension, not problem the user open SQL file, now he make SaveAs and type new name without extension, here the dialog return it as PAS extension.

Set FilterIndex to the appropriate value depending on the currently opened file-extension?
See LazEdit (http://wiki.lazarus.freepascal.org/LazEdit) for example.

Bart

Reply by email

Zaher Dirkey
to Bart
Bart wrote 12 lines
On 6/16/12, Zaher Dirkey wrote: > For example, my project is an editor for multitype files, PAS, LFM, SQL > now the default is PAS and it is the first extension, not problem > the user open SQL file, now he make SaveAs and type new name without > extension, here the dialog return it as PAS extension. Set FilterIndex to the appropriate value depending on the currently opened file-extension? See LazEdit (http://wiki.lazarus.freepascal.org/LazEdit) for example.

Yes index is useful here but, what if we have in one line more than extension (*.pas *.pp *.inc) like as in Lazarus, here i need to fix it manually.

Except if it fixed in LCL when the DefaultExt include in (*.pas *.pp *.inc) so it must use DefaultExt.

I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120617/16a7c045/attachment.html>

Reply by email

Mattias Gaertner
to Zaher Dirkey
Show quoted text 21 lines
On Sun, Jun 17, 2012 at 1:42 PM, Bart wrote: > On 6/16/12, Zaher Dirkey wrote: > > > For example, my project is an editor for multitype files, PAS, LFM, SQL > > now the default is PAS and it is the first extension, not problem > > the user open SQL file, now he make SaveAs and type new name without > > extension, here the dialog return it as PAS extension. > > Set FilterIndex to the appropriate value depending on the currently > opened file-extension? > See LazEdit (http://wiki.lazarus.freepascal.org/LazEdit) for example. > > Yes index is useful here but, what if we have in one line more than extension (*.pas *.pp *.inc) like as in Lazarus, here i need to fix it manually. Except if it fixed in LCL when the DefaultExt include in (*.pas *.pp *.inc) so it must use DefaultExt.

IMO the user should see what the default extension is. A function is needed to move an extension to the front. I don't know how this works for RTL languages.

I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Mattias

Reply by email

Bart
to Zaher Dirkey: Yes index is useful here but, what if we have in one line more than extension (*.pas *.pp…
Zaher Dirkey wrote
Yes index is useful here but, what if we have in one line more than extension (*.pas *.pp *.inc) like as in Lazarus, here i need to fix it manually.

By default it picks the first one.
If you do not want this, you either have to adjust the filter, or IMO a better option, use seperate filters for each supported extension, so basically split *.ap;*.pp;*.inc into 3 seperate ones.

Bart

Reply by email

Zaher Dirkey
to Bart
Bart wrote 12 lines
On 6/17/12, Zaher Dirkey wrote: > Yes index is useful here but, what if we have in one line more than > extension (*.pas *.pp *.inc) like as in Lazarus, here i need to fix it > manually. > By default it picks the first one. If you do not want this, you either have to adjust the filter, or IMO a better option, use seperate filters for each supported extension, so basically split *.ap;*.pp;*.inc into 3 seperate ones.

Thanks

In fact changed the order of this filter and bring the default one for the first

This is my project
https://github.com/parmaja/miniedit/commits/master

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120617/5bf3bb36/attachment.html>

Reply by email