Solved

How to make OnIncludeItem work for OpenDialog

Posted on 2004-04-11
2
767 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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

7 Experts available now in Live!

Get 1:1 Help Now