Solved

How to make OnIncludeItem work for OpenDialog

Posted on 2004-04-11
2
772 Views
Last Modified: 2007-12-19
The basic question is "if I want to make OnIncludeItem exclude some files, how do I do it"?

I know the name of the files I want to exclude.

There are two parts to my question, based on where I am up to:

1) What is wrong with this:

procedure TMainForm.DontShowAlreadyLoadedMods(const OFN: TOFNotifyEx; var Include: Boolean);
begin
    Debug('OnIncludeItem...');
    Include := False;
end;

procedure TMainForm.RegisterNewModMenuItemClick(Sender: TObject);
    var TheZipName: string;
        ModOpenDialog: TOpenDialog;
        i: integer;
begin
    TellUser('Initiate mod file open...');

    ModOpenDialog := TOpenDialog.Create(self);

    ModOpenDialog.InitialDir := CurrentGame^.GameModDir;
    ModOpenDialog.Options := [ofEnableIncludeNotify, ofAllowMultiSelect, ofPathMustExist, ofFileMustExist, ofHideReadOnly, ofEnableSizing];
    ModOpenDialog.Filter := 'Mod Zip Files|*.zip';
    ModOpenDialog.OnIncludeItem := DontShowAlreadyLoadedMods;

    TellUser('looking in ' + CurrentGame^.GameModDir);

    if not(ModOpenDialog.Execute) then
...


I would have thought that this would result in no files being displayed in the OpenDialog, since I return False always from OnIncludeItem.  I have confirmed that OnIncludeItem is being called, but it makes no difference to the outcome: all the .zip files in the directory are displayed.

What am I missing?

2) Suppose that worked, then how do I determine the file name of the file under consideration: it must be hidden inside OFN, but darned if I can see where!

Thanks!
0
Comment
Question by:GreenAsJade
2 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 495 total points
ID: 10852711
Hi

OnIncludeItem won't work.

Read 3rd question there:
http://msdn.microsoft.com/msdnmag/issues/03/10/CQA/default.aspx
0
 

Author Comment

by:GreenAsJade
ID: 10852822
Well, knowning that can save some heartache.

So do I have to write my open file open dialog, or is there some less extreme option?

Thanks,
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now