List Configuration OCX

Version 2.1.0.2 - 04/11/2001


This is the instruction page for the List Configuration OCX file.  It is called List Configuration because the data is stored in a hidden listbox.  API calls and standard listbox methods are used to edit the list at runtime.  The List Configuration OCX file was made to overcome some of the limitations of the INI file format.  There is no file extension set for this format, instead the program that use it assigns its own extension e.g. Application Launcher Editor uses the .alf extension.  It has the following advantages over the INI format:

Download the latest version from here - http://www.martin2k.co.uk/vb6/ocxs/listconfig.zip

Changes since V 2.0.0.1 - 15/09/2001

Changes since V 2.0.0.2 - 19/09/2001

How to Use

The INI format looks like this:

[windows]
load=
run=
NullPort=None
device=EPSON Stylus COLOR 580,EPIJNL30,\\EVESHAM\EPSON580

and the List Configuration format is like this:

Start In Location7=c:\Games\Ford Racing
Start In Location1=c:\Games\Black&White
Item count=27
Desc14=Longbow 2
Command14=c:\Games\Janes\Longbow2\LB2.EXE
Parameters14=
Startin14=c:\Games\Janes\Longbow2
Icon14=c:\Games\Janes\Longbow2\LB2.EXE
Desc13=Klingon Academy Multiplayer Demo
Command13="C:\Games\Mags\pc\klingon academy\KALaunch.exe"
Parameters13=
Startin13=c:\GAMES\MAGS\PC\KLINGO~1
Icon13="c:\Games\Mags\pc\klingon academy\KALaunch.exe"
Desc12=Jetpack
Command12=c:\Games\Jetpack\JETPACK.EXE
Parameters12=
Startin12=c:\Games\Jetpack
Icon12=c:\Games\Jetpack\JETPACK.EXE
Desc11=Half-Life
Command11=c:\Games\Half-Life\hl.exe
Parameters11=

As you can see, there are no sections.

When working with this format, it is not recommended that you use equals (=) signs in the Key and Strings as it may have undesired effects in the program, as was the case with the INI format.

When adding or editing items, they will appear at the bottom of the list.  E.g. if you were to edit the 'Startin13' Key, this would go to the bottom of the file (after 'Parameters11').

Methods in the List Configuration OCX

All strings are case sensitive.

GetAll

Returns the whole list:

var = ListConfig1.GetAll

The variable 'var' would now hold all the text in the above example.

GetList

Returns a string from the Key specified:

var = ListConfig1.GetList("Startin12")

The variable 'var' would now contain the string 'c:\Games\Jetpack'.  If the item is not found, the string '[NOT FOUND]' is returned.

LoadConfig

Loads a file so that it is ready for editing:

ListConfig1.LoadConfig "C:\Files\Test.txt"

The file 'C:\Files\Test.txt' will be loaded.

RemAll

Removes all data from the list resulting in an empty file.

ListConfig1.RemAll
RemKey

Removes the key specified:

ListConfig1.RemKey "Command11"

The key called 'Command11' would now be removed.

SaveConfig

Saves the entries on the list to a file:

ListConfig1.SaveConfig "C:\Files\Test.txt"

The file 'C:\Files\Test.txt' would be saved.

SetList

Syntax - ListConfig1.SetList Text, Key.  Adds or edits an entry in the list:

ListConfig1.SetList "-console", "Parameters11"

Set Methods

The List Configuration OCX allows easily edit sets of data.  Here is an example of a set:

Employees=4
Name1=Charlotte Baon
JobTitle1=Secretary
Phone Ext1=4893
Medical1=0
Name2=Olive Clinton
JobTitle2=Manager 
Phone Ext2=6832
Medical2=0
Name3=Helen Major
JobTitle3=Receptionist
Phone Ext3=2948
Medical3=1
Name4=Kate Baon
JobTitle4=Supervisor
Phone Ext4=4689
Medical4=0

In this example, each set has 4 entries - Name, JobTitle, Phone Ext and Medical.  The first line shows how many sets there are.  Each entry has a number after it representing the set number.  The set methods in this OCX allow you to work with this type data.  To start a set, you need to use this line:

ListConfig1.SetList 0, "Employees"
AddSet

Syntax - ListConfig1.AddSet SetName, Text, Key.  This method adds a set to the list.  Before adding a set of data, you will need to use the AddSetCount method to add to the number of sets.  E.g to add two employees to the example:

ListConfig1.AddSetCount "Employees"
ListConfig1.AddSet "Employees", "Mel Dixon", "Name"
ListConfig1.AddSet "Employees", "Cleaner", "JobTitle"
ListConfig1.AddSet "Employees", "NA", "Phone Ext"
ListConfig1.AddSet "Employees", 1, "Medical"
ListConfig1.AddSetCount "Employees"
ListConfig1.AddSet "Employees", "Karen Syzalic", "Name"
ListConfig1.AddSet "Employees", "Administration", "JobTitle"
ListConfig1.AddSet "Employees", 2345, "Phone Ext"
ListConfig1.AddSet "Employees", 0, "Medical"

The first line will now read:

Employees=6
AddSetCount

Use this before the AddSet method to add to the number of sets (AddSetCount SetName):

ListConfig1.AddSetCount "Employees"
CheckDupSets

Syntax - ListConfig1.CheckDupSets SetName, Key, CheckString.  Checks to see if a key value will be duplicated in a set and returns a number.  This can be used to stop people entering data that they have already entered e.g:

The above example has the following line:

Name2=Olive Clinton

If the program ran this line of code:

var = ListConfig1.CheckDupSets("Employees", "Name", "Olive Clinton")

the number 2 would be returned, which means that this employee should not be added again.  If a different name was checked, 0 would be returned meaning that it is OK to add.

DocJoin

Syntax - DocJoin SetName, Key

Returns a string, which is all the text that was split using the DocSplit method.  E.g. if you ran it on this set:

Test1=You can drag file and folder icons from 
Test2=the desktop or a folder &cr;to a command p
Test3=rompt instead of typing the file or fold
Test4=er name. &cr;The file or folder name is th
Test5=en placed in the keyboard buffer &cr;of th
Test6=e running MS-DOS-based program.
Tests=6

It would return this:

You can drag file and folder icons from the desktop or a folder 
to a command prompt instead of typing the file or folder name. 
The file or folder name is then placed in the keyboard buffer 
of the running MS-DOS-based program.
DocSplit

Syntax - DocSet SetName, Key, Text, Length

Because there is a limit to how many characters can be stored per line, this method will allow you to split very long strings to different into a set.  For example, if someone wrote the following text:

You can drag file and folder icons from the desktop or a folder 
to a command prompt instead of typing the file or folder name. 
The file or folder name is then placed in the keyboard buffer 
of the running MS-DOS-based program.

 in a multiline textbox and called the setname 'Tests' and the Key name 'Test' and used the DocSet command on it with a length of 40 for each key, it would look like this in the file:

Test1=You can drag file and folder icons from 
Test2=the desktop or a folder &cr;to a command p
Test3=rompt instead of typing the file or fold
Test4=er name. &cr;The file or folder name is th
Test5=en placed in the keyboard buffer &cr;of th
Test6=e running MS-DOS-based program.
Tests=6

It is recommended that you do not use a length over 333.  Use the DocJoin method to join the text back together again.  '&;' is used where there is a carriage return and '&;' where there is a ampersand.

DownSet

Changes the order of the data by moving one set of data after another e.g:

ListConfig1.DownSet "Name", 3
ListConfig1.DownSet "JobTitle", 3
ListConfig1.DownSet "Phone Ext", 3
ListConfig1.DownSet "Medical", 3

The list will now read like this i.e. 3 and 4 have swapped around:

Name3=Kate Baon
JobTitle3=Supervisor
Phone Ext3=4689
Medical3=0
Name4=Helen Major
JobTitle4=Receptionist
Phone Ext4=2948
Medical4=1
EditSet

Syntax - EditSet Text, Key, Pos.  Edits an item in a set e.g:

ListConfig1.EditSet "Team Leader", "JobTitle", 1

This is the same as:

ListConfig1.SetList "Team Leader", "JobTitle1"
RemSet

Syntax - ListConfig1.RemSet SetName, Key, Pos.  This method removes a set from the list.  Before removing a set of data, you will need to use the SubSetCount method to subtract from the number of sets.  E.g to remove two employees from the example:

ListConfig1.SubSetCount "Employees"
ListConfig1.RemSet "Employees", "Name", 5
ListConfig1.RemSet "Employees", "Job Title", 5
ListConfig1.RemSet "Employees", "Phone Ext", 5
ListConfig1.RemSet "Employees", "Medical", 5
ListConfig1.SubSetCount "Employees"
ListConfig1.RemSet "Employees", "Name", 6
ListConfig1.RemSet "Employees", "Job Title", 6
ListConfig1.RemSet "Employees", "Phone Ext", 6
ListConfig1.RemSet "Employees", "Medical", 6
SubSetCount

Use this before the RemSet method to subtract from the number of sets (SubSetCount SetName):

ListConfig1.SubSetCount "Employees"
UpSet

Changes the order of the data by moving one set of data before another e.g:

ListConfig1.DownSet "Name", 2
ListConfig1.DownSet "JobTitle", 2
ListConfig1.DownSet "Phone Ext", 2
ListConfig1.DownSet "Medical", 2

The list will now read like this i.e. 1 and 2 have swapped around:

Name1=Olive Clinton
JobTitle1=Manager 
Phone Ext1=6832
Medical1=0
Name2=Charlotte Baon
JobTitle2=Secretary
Phone Ext2=4893
Medical2=0

Martin Allen - 2001 | http://www.martin2k.co.uk