Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problem with OpenDialog component: ofEnableIncludeNotify property and IncludeItem event

Posted on 2004-09-01
2
533 Views
Last Modified: 2010-04-04
How to make the event IncludeItem of TOpenDialog work?

I have set the ofEnableIncludeNotify property to true and written this code.......

procedure TForm1.OpenDialog1IncludeItem(const OFN: TOFNotifyEx;
  var Include: Boolean);
begin
 Include:=False;
end;

However, still all files are displayed when I execute the OpenDialog. The above code does get trigerred for every file, but soemhow the Include variable has no effect.

I know it is a bug in Microsoft implementation, (plenty of websites on internet refer to this)........... but does anyone know of a work around?

I am using Delphi 7 on Windows XP. Application deployment would be on Windows 2000 & XP, XP SP1, XPSP2 machines.
0
Comment
Question by:GSPannu
2 Comments
 
LVL 6

Accepted Solution

by:
vadim_ti earned 500 total points
ID: 11956404
It is not exactly what you want, but may be you can apply
filter. In this sample only
a.*
b.*
*.tiff
files will be displayed.


procedure TForm1.Button1Click(Sender: TObject);
var
  ofn:tagOFNA;
  szFile: array [0..260] of char;
begin
  inherited;

FillChar(ofn, sizeof(tagOFNA), 0);
ofn.lStructSize := sizeof(tagOFNA);
ofn.hwndOwner := handle;
ofn.lpstrFile := szFile;
ofn.lpstrFile[0] := #0;
ofn.nMaxFile := sizeof(szFile);
ofn.lpstrFilter := 'My Files'#0'a*.*;b*.*;*.tiff'#0;
ofn.nFilterIndex := 1;
ofn.lpstrFileTitle := nil;
ofn.nMaxFileTitle := 0;
ofn.lpstrInitialDir := nil;
ofn.Flags := OFN_PATHMUSTEXIST or OFN_FILEMUSTEXIST or OFN_EXPLORER ;
  GetOpenFileName(ofn);
end;
0
 

Author Comment

by:GSPannu
ID: 11961670
Dear Vadim,

Thank you for your quick response.

Could you email me (guru.pannu@pri.co.uk) a complete Delphi project (.pas, .dfm, .dpr) explaining what you have just written?

I haven't been able to understand your answer fully.

Thx. Guru
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question