Hey, im writing a dictionary in Delphi, and i dont know how to solve 1 problem. How to make Delphi display an explanation for the selected word from the word list? :confused:

Theres a lot of potential answers for this, how hae you stored your words vs defintiions? which version of delphi are you using?, how much experience do you have? and what have you read about and dismissed so far (and why was it dismissed)?

Im using Delphi 7. I've stored words in TXT file, 1 words per line. I have enough expirience to make that dictionary :D and i read lots of tuts... and i didnt found anythis about this.

COMEON PPL! help me!! i need it really badly!

You didnt entirely answer the question about how your dictionary was laid out, you said you stored words in a txt file, how? wheres the description?

A better answer by the sounds of it would have been a database. However, if you take a look at stringlist you'll see a keyd list and you could use that, assuming you read the word and description in correctly.

Well, yeah, i seen it now. My idea now is to put words into a list by String List, and i want to do like, when you click on a word in List box, or when you type in the word in Edit box and press ENTER, it shows the explanation for that word in Memo box. And i dont know how to do that.
In my project, i used Memo box, List box and Edit box.

string list will do that for you if you do it right.. Hold both the word and the description..

Then, can u tell me how to do that?
But i think, that reading from a file is better, cuz ill be adding hundrets of words in there. So i think reading a description from a file, will be way better. But that will work 2.

Well. Take a look at stringlist - theres enough examples.

I dont understand... i looked at that StringList, and i didnt see anything at all, that could helped me.

String list has name and values....

ummm... can you explain normaly?

It seems theres no point, as you're blatently not looking or trying anything yourself.

what ever... im trying everything, i think of.
Ty anyway... LizR'd

A Stringlist is a class of Tstring. It contains a list of strings that can be accessed and managed through the various methods (add, delete, find etc..) It also allows you to separate each string using a NameValueSeparator. The character assigned to this property is used to separate any of the strings into two parts. the first could be used as your word, and the second as the definition. Stringlists also provide the ability to use streams so that you have built-in access to the file of choice through the class. You may find examples online. One good source would be MArco Cantu who has written many books on Delphi. Another source is the about.com site. Lookup Delphi and PAscal to tie into their resources.

Thanks jsosnowski, thats the best anwser i've seen, it helped me understand something :)

Something you could have read up on for yourself, but decided it would be far easier to have someone else do it.

To read from a file using tstringlist object,

thestringlist.loadfromfile('c:\dictionary.txt');

To write to a file using tstringlist object,

thestringlist.savetofile('c:\dictionary.txt');

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.