Board index » delphi » Tchecklistbox..Saving Checks

Tchecklistbox..Saving Checks

I am stumped.  I can't figure out a good way to save the items that are
checked into *.ini file etc.  I have a dynamic list that can change from
other parts of the program.  I have tried saving and loading by itemindex
but this does not work properly since the index can change. Does someone
know of a good way to do this?

--

Marko
---------------
m...@sepcoinc.com

 

Re:Tchecklistbox..Saving Checks


Quote
Marko wrote in message ...
>I am stumped.  I can't figure out a good way to save the items that are
>checked into *.ini file etc.  I have a dynamic list that can change from
>other parts of the program.  I have tried saving and loading by itemindex
>but this does not work properly since the index can change. Does someone
>know of a good way to do this?

Does it have to be an in file? A binary file of this:
  type
     TCheckListItem = record
        UniqueID : integer;
        Text : ShortString;
        Checked : boolean;
      end;

would be one solution. I suppose an ini file could look
like this:

[CheckListBox]
ItemCount=15

[Item0]
Text=Hello
Checked=0
[Item2]
Text=World
Checked=1
:
[Item14]
Text= !!
Checked=0

You would simply read the values back in a loop, counting up
to the value stored in "ItemCount". The section names would
be "Format('Item%d', [LoopVar]);"

HTH
--
Jeremy Collins
Kansai Business Systems
http://www.kansai.co.uk/

Re:Tchecklistbox..Saving Checks


I have some code at home that does this.  I save to an INI file.  I will
have to look at it though to see exactly what I am doing.  If you want to
see the performance I have a program at
http://members.truepath.com/LewisHowell on my freeware page.  The program
helps track your Bible reading, it is religious in nature.

I write checked boxes to an ini file and read them out as well.  Perfomance
seems fine for me.  If you download it, set it up as instructed, then go to
the book of Psalms and check off all the books (about 150 checkboxes).  Then
navigate in and out of that book and see what the performance is.

I will check the code out tonight and send it to you, if you have any
questions feel free to email me at lewishow...@yahoo.com

By the way, how is your PPP and RAS stuff coming along?

Lewis Howell
lewishow...@yahoo.com
Lou's Delphi Tip of the Day
http://members.truepath.com/delphi
Lou's Personal WebPage
http://members.truepath.com/LewisHowell

Quote
Marko wrote in message ...
>I am stumped.  I can't figure out a good way to save the items that are
>checked into *.ini file etc.  I have a dynamic list that can change from
>other parts of the program.  I have tried saving and loading by itemindex
>but this does not work properly since the index can change. Does someone
>know of a good way to do this?

>--

>Marko
>---------------
>m...@sepcoinc.com

Other Threads