Article ID: 140348
Article Last Modified on 2/10/2000
Row Program_type Number_of_Files ----------------------------------- 1 EXE 2 2 HLP 3 3 PRG 4The Outline looks like this:
EXE
Exe1
Exe2
Exe3
HLP
Hlp1
Hlp2
Hlp3
PRG
Prg1
Prg2
Prg3
The item to select is the PRG category type. The ListIndex of the item
to select is:
3+ 2 = 5 (go through the array in descending order, and calculate the
number of files above).
5+ 3-1 = 7 (adds the number of categories).
CLOSE ALL
CREATE DATABASE mscodedbc
CREATE TABLE MSCODETYPE (code_description C(3)) && Adds table to mydbc1
INSERT INTO mscodetype values ('PRG')
INSERT INTO mscodetype values ('HLP')
INSERT INTO mscodetype values ('APP')
CREATE TABLE MSCodeExamples (program_type C(3), Program_name M)
INSERT INTO mscodeExamples VALUES ('PRG', 'prgProgram1')
INSERT INTO mscodeExamples VALUES ('APP', 'appTest1')
INSERT INTO mscodeExamples VALUES ('HLP','hlpHelp1')
INSERT INTO msCodeExamples VALUES ('PRG', 'prgProgram2')
INSERT INTO msCodeExamples VALUES ('HLP','hlpHelp2')
SELECT MSCodeType
DIMENSION laNumAdded(RECCOUNT(),2)
SCAN
* Build the code types- the first indent of the outline
This.AddItem(MSCodeType.Code_Description)
laNumAdded(RECNO(),1) = 0
laNumAdded(RECNO(),2) = MSCodeType.Code_Description
ENDSCAN
* The table that contains file names
SELECT MSCodeExamples
SCAN
nIsTypeInArray=ASCAN(lanumadded,MSCodeExamples.Program_type)
nRow=ASUBSCRIPT(lanumadded,nIsTypeInArray,1)
* Find the position of the category in the array
laNumAdded(nRow,1) =laNumAdded(nrow,1) + 1
This.ListIndex = 0 && No item selected
* Loop through the array
FOR I = nrow-1 TO 1 STEP - 1
IF MSCodeExamples.Program_Type=lanumadded(1,2)
*aNumAdded(MSCodeExamples.Program_Type,2) = 0
This.ListIndex = 0
EXIT
ELSE
* Increment the index
This.ListIndex = This.ListIndex + laNumAdded(i,1)
ENDIF
ENDFOR
* Add the number of file categories to the ListIndex
This.ListIndex = This.ListIndex +nrow-1
lcProgram_Name = MLINE(MSCodeExamples.Program_Name,1)
* Add the item to the outline. It is added to the end of the subitems of
* the item currently selected.
This.AddItem(lcProgram_Name)
This.PictureType(This.ListIndex + ;
laNumAdded(MSCodeExamples.Program_Type,1)) = 2
ENDSCAN
This.ListIndex = 0
This.Parent.ReFreshAdditional query words: VFoxWin OCX
Keywords: kbcode KB140348