Recent

Author Topic: TFileNameEdit Extension Not Triggered  (Read 8617 times)

mudah

  • New Member
  • *
  • Posts: 13
TFileNameEdit Extension Not Triggered
« on: May 29, 2011, 05:38:40 pm »
Dear all,

I register a few extension in FileNameEdit.Filter. But everytime I choose a file, FileNameEdit.text only show a filename without extension.

If I set defaultExt (.txt), it will always use .txt even if I choose different extension from the Dialog.

Can someone help me please? or should I proceed with bug report?

Quote
Lasarus version: 0.9.30
FPC Version: 2.4.2
SVN Revision: 29749


Thanks
« Last Edit: May 29, 2011, 05:40:55 pm by mudah »

eny

  • Hero Member
  • *****
  • Posts: 1646
Re: TFileNameEdit Extension Not Triggered
« Reply #1 on: May 29, 2011, 05:49:56 pm »
or should I proceed with bug report?

And there is a bug because...?

This page will give you the answers you seek: http://www.delphibasics.co.uk/RTL.asp?Name=TOpenDialog
« Last Edit: May 29, 2011, 05:54:02 pm by eny »
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

mudah

  • New Member
  • *
  • Posts: 13
Re: TFileNameEdit Extension Not Triggered
« Reply #2 on: May 30, 2011, 03:11:44 am »
Thanks a lot Eny for your reply

Quote
And there is a bug because...?

...because it never show file extension. Say I choose DialogKind = dkSave then I execute the Dialog, then I choose MyFile with extension .pas. The output given by .Text or .FileName will show C:\MyFolder\MyFile without .PAS at the end.

Quote
This page will give you the answers you seek: http://www.delphibasics.co.uk/RTL.asp?Name=TOpenDialog
Perhaps I miss out to find similarity between TFileNameEdit and TOpenDialog. Can you help me point out where should I start to get the file extension appear in .FileName property?

Thanks a lot!

eny

  • Hero Member
  • *****
  • Posts: 1646
Re: TFileNameEdit Extension Not Triggered
« Reply #3 on: May 30, 2011, 08:58:20 am »
In general it works best to post (part of the) code where it shows what you have done with the components. Now we have to guess.

My best guess is that you didn't configure the filter property correctly, which is on the page I gave you:
Code: Pascal  [Select][+][-]
  1. // Allow only .dpr and .pas files to be selected
  2. openDialog.Filter := 'Delphi project files|*.dpr|Delphi pascal files|*.pas';
All posts based on: Win10 (Win64); Lazarus 3_4  (x64) 25-05-2024 (unless specified otherwise...)

mudah

  • New Member
  • *
  • Posts: 13
Re: TFileNameEdit Extension Not Triggered
« Reply #4 on: June 01, 2011, 08:34:22 am »
Hi Eny,

Thank you so much for your advice. I don't have access to the code right now, but will post the it once I'm back to office.

Best!
Mudah

mudah

  • New Member
  • *
  • Posts: 13
Re: TFileNameEdit Extension Not Triggered
« Reply #5 on: June 01, 2011, 05:33:12 pm »
Hi Eny

Perhaps I messed up too much with FileNameEdit property which causing this kind of problem. After recreating back FileNameEdit component in my form, issue gone.

Thank you so much for your help up to this stage.


Best!
Mudah

 

TinyPortal © 2005-2018