Recent

Author Topic: OpenDialog Filter  (Read 33040 times)

Balf

  • New Member
  • *
  • Posts: 19
OpenDialog Filter
« on: March 31, 2011, 11:53:51 am »
Hello, I am trying to only list .dbf files in the open file dialogue window but I see all file types.  Can anyone tell me what I am doing wrong? Thanks.
   var
    MyDataFile : string ;
begin
     if OpenDialog1.Execute then
   begin
     OpenDialog1.Filter := '*.dbf' ;
     MyDataFile := OpenDialog1.FileName ;
   end.
end
new to Ubuntu 10 but learning

Mando

  • Full Member
  • ***
  • Posts: 181
Re: OpenDialog Filter
« Reply #1 on: March 31, 2011, 12:28:18 pm »
Hello:

You must set filter before call execute method of the dialog.

Code: [Select]
var
    MyDataFile : string ;
begin
   OpenDialog1.Filter := 'DBase Table|*.dbf' ;
   if OpenDialog1.Execute then
         MyDataFile := OpenDialog1.FileName ;
 
end


... or set it in edit-time in the object inspector.


regards.

Balf

  • New Member
  • *
  • Posts: 19
Re: OpenDialog Filter
« Reply #2 on: March 31, 2011, 01:24:59 pm »
Thanks for that - it almost works!  Is it possible to have a filter expression the way I had it i.e. '*.dbf' as apposed to 'DBase Table|*.dbf' because:

 OpenDialog1.Filter := '*.dbf' ;
   if OpenDialog1.Execute then
         MyDataFile := OpenDialog1.FileName ;

doesn't work and my level 7 dbase tables aren't listed when I use
 'DBase Table|*.dbf'
new to Ubuntu 10 but learning

Mando

  • Full Member
  • ***
  • Posts: 181
Re: OpenDialog Filter
« Reply #3 on: March 31, 2011, 01:30:04 pm »
¿What is the extension for dbase tables level 7?



Balf

  • New Member
  • *
  • Posts: 19
Re: OpenDialog Filter
« Reply #4 on: March 31, 2011, 01:40:27 pm »
.dbf
new to Ubuntu 10 but learning

Balf

  • New Member
  • *
  • Posts: 19
Re: OpenDialog Filter
« Reply #5 on: March 31, 2011, 01:45:31 pm »
It wasn't the table type it was the case of the extension ie it lists all *.dbf but not *.DBF 
Is there a way to make it list both? Thanks, Peter
new to Ubuntu 10 but learning

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: OpenDialog Filter
« Reply #6 on: March 31, 2011, 03:49:00 pm »
Some Delphi solution: http://www.delphipages.com/forum/showthread.php?t=193852

Maybe you should try:
Code: [Select]
OpenDialog1.Filter := '*.dbf; *.DBF';
You are on Windows? Then it case-sensitivity is IMO bug.

Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Balf

  • New Member
  • *
  • Posts: 19
Re: OpenDialog Filter
« Reply #7 on: March 31, 2011, 04:06:32 pm »
Thanks.

OpenDialog1.Filter := '*.dbf; *.DBF';
selected all file types

but
 
OpenDialog1.Filter := 'All Files|*.dbf;*.DBF;'
worked

I'm on Ubuntu 10 by the way
new to Ubuntu 10 but learning

 

TinyPortal © 2005-2018