Author |
Topic  |
|
w2m
   
USA
1990 Posts |
Posted - Jun 17 2014 : 12:34:31
|
I have a combobox that holds a list of image categories like:
NASA BIRDS DOGS
and I want to associate all of the image filenames stored in TImageEnMView with the selected category in the combobox.
In other words, when NASA is selected in the combobox all of the image filenames associated with NASA are loaded into TImageEnMView.
So somehow, I need to develop a persistent storage mechanism that can be saved to an ini file or to a database I guess. When the app is run, the list of categories are loaded into a TCompoBox from an ini file or a datsabsae. When a category is selected in the combobox all of the files associated to the category are loaded into TImageEnMView. So for example if NASA was selected in the combobox all of the images associated with NASA would be loaded into TImageEnMView.
I have not run into this before so I am looking for some advise. Should I use a database to store the linked lists or is there a simpler way to achieve this?
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
|
xequte
    
39056 Posts |
Posted - Jun 18 2014 : 03:09:01
|
Hi Bill
If the data does not frequently change, then an INI file is easier with less overhead. If your application needs to frequently update the categorization, then you may want to look into a DB. The other consideration is the size of your list.
I've done this many times in the past. If the image to category relationship is one to one (i.e. each image only belongs to one category) then what you might consider is just using folders, i.e. the folder is the "category" and your combobox simply displays the list of folders.
If an image can belong to multiple categories, then use an file that lists each image and its associated category, e.g.
NasaBuilding.jpg=Nasa,Buildings
You would load this file once into memory and iterate through all the items to find those that match your category.
Another way is to use an INI file, where the section is the category, e.g.
[Nasa] Img1=NasaBuilding.jpg Img1=Rocket.jpg Img3=Wernher_von_Braun.jpg
Your combobox just reads the list of sections, and when a category is selected you read all the names from the ini (use a TMemIniFile for speed).
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
w2m
   
USA
1990 Posts |
|
wesleybobato
  
Brazil
367 Posts |
Posted - Jun 19 2014 : 11:22:42
|
Hi William
I'm very good at it because here in Brazil we use a lot of it.
Use 2 TClientDaset and Create a Master Detail Relationship. Save the information in the XML TClientDaset Place.
you need me to create an Example Explaining Step by Step? |
 |
|
w2m
   
USA
1990 Posts |
Posted - Jun 19 2014 : 11:44:56
|
Hi Wesley,
For the time being we are using TMemIniFile to store the filenames, but if that proves to be a problem then the only other choice is to use a database, so... yes a demo would be nice in case we have problems. We use a TCombobox to hold the image categories and save the categories to a TMemIniFile. The thumbnails are loaded into TImageEnMView for the selected category.
Thanks,
Bill Miller Adirondack Software & Graphics Email: w2m@hughes.net EBook: http://www.imageen.com/ebook/ Custom Commercial ImageEn Development |
 |
|
wesleybobato
  
Brazil
367 Posts |
Posted - Jun 19 2014 : 11:53:32
|
Hello William.
This is not a database is Equal TMemIniFile. the difference is that TClientDataset own classes and methods that facilitate the development.
I'll Create an Example and Send Tomorrow you will.
Have a Wonderful Day |
 |
|
|
Topic  |
|