Solved

How to make OnIncludeItem work for OpenDialog

Posted on 2004-04-11
2
776 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

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…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 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