I would like to offer the user some files in a dialog box that have a similar file name.
I remember several times being told people had rolled their own.
I went looking in the Xojodev community section and in the forum for examples and couldn’t find any (except for Bob Keeney’s video).
I assume MonkeyBread has something, but…
I also assume I would have to subclass the dialog.
Any suggestions?
This is particularly vague.
Could you be more precise ? Are these files in the same folder ? You offer them for what ? Opening them ? Something else ?
Sorry. Yes, the items are in the same folder. It is so the user can choose between a couple of default examples.
They would then be copied to another folder.
I have other ways to present it, but I’m looking at learning what other ways I can modify the dialog window.
Use a simple OpenDialog with InitialDirectory set to that folder.
http://documentation.xojo.com/index.php/OpenDialog
Another way of explaining what I want is something like Filetypes. A file type will only allow selection of certain types. I want the reverse where files with part of the name being similar are highlighted. Are there examples of how to modify a dialog to show something like that?
You should read the page I linked to. See FIlter.
Add a window
Add a listbox
In the window open event, get a folderitem of ‘the folder’
The folderitem has a count property
Get each child file in turn
If the child file name matches your requirement, add the name to the listbox
Add the folderitem to listbox.rowtag (listbox.lastindex )
Then if someone clicks a row, you can get the folderitem from the rowtag
Jeff`s method is a good way to do if you don’t want the user to be able to change to another directory.
Otherwise, Michel’s method is the recommended way.
[quote=326398:@Michel Bujardet]Use a simple OpenDialog with InitialDirectory set to that folder.
http://documentation.xojo.com/index.php/OpenDialog[/quote]
I gather its more a file name pattern, rather than only ‘files of type’
For example, showing all pictures from this list would be wrong:
Testfile.jpg
Sample34.jpg
Sample38.jpg
MyHolidays.jpg
I think Arthur wants to be able to display only ‘where filename contains…’ or ‘filename begins…’
And so, display only
Sample34.jpg
Sample38.jpg
from that hypothetical folder
Then I would go your solution. The standard, unmodified dialog is not able to do this kind of filtering.
Thanks. RowTag is what I want. I had avoided it for all sorts of things. Lots of possibilities.
Jeff is also correct. I would store files ‘where filename contains…’
The file would be used something like “topics” for a database list and I could have a 4 column list in the title.