I'm studying the Guide to DarkBasic and am in Chapter 15 that covers FileManager Program. There is a part of the Source Code that I don't understand.
I've attached the code as a wordPad file.
The Arrays are given the value of :
ô¿ô
NewCommand(1) = 0
CurrentPage(1) = 0
CurrentSelectedItem(1) = 1
MaxFiles(1) = 0
PageSize(1) = 20
PageStartY(1) = 40
FileSpacing(1) = 16
ô¿ô
However in the FUNCTION DisplayFiles
it has the calculations :
------
PageOfFiles = CurrentPage(1)*PageSize(1)
-----
Complete function below:
FUNCTION DisplayFiles()
Black = RGB(0,0,0)
White = RGB(255,255,255)
Blue = RGB(0,0,255)
Red = RGB(255,0,0)
FIND FIRST
MaxFiles(1) = 0
WHILE GET FILE TYPE()<> -1
MaxFiles(1) = MaxFiles(1) + 1
FIND NEXT
ENDWHILE
FIND FIRST
PageOfFiles = CurrentPage(1)*PageSize(1)
FOR X = 1 to PageOfFiles
FIND NEXT
NEXT X
FOR X = 0 TO PageSize(1)-1
IF GET FILE TYPE() = -1
EXIT
ENDIF
PosY = ((x)*FileSpacing(1))+PageStartY(1)
IF GET FILE TYPE() = 0
TempString$ = GET FILE NAME$()
TempString2$ = GET FILE NAME$()+" "+GET FILE DATE$()
ELSE
TempString$ = "<"+GET FILE NAME$()+">"
TempString2$ = "<"+GET FILE NAME$()+"> "+GET FILE DATE$()
ENDIF
IF CurrentSelectedItem(1)=(x-StartA)+1
INK White,Blue
CurrentFile$(1) = GET FILE NAME$()
CurrentFileType(1) = GET FILE TYPE()
TEXT 10,PosY, TempString$
SpaceString$ = " "
FOR y = 1 to 120
SpaceString$ = SpaceString$ + " "
NEXT y
INK White, Black
CENTER TEXT 320,380, SpaceString$
CENTER TEXT 320,380, TempString2$
ELSE
INK White,Black
TEXT 10,PosY, TempString$
ENDIF
FIND NEXT
NEXT X
ENDFUNCTION
End of the function statement.
From what I can figure in:
PageOfFiles = CurrentPage(1)*PageSize(1)
PageOfFiles should = 0 (see below)
(PageOf Files = 0 * 20)
What am I missing.
I I've added the complete source code below but I'm new and I don't think it will be added to my question.
Thanks in advance,
Yekoms
Keep'em Movin