Solved

How to make OnIncludeItem work for OpenDialog

Posted on 2004-04-11
2
790 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

737 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