I tried writing a program that will hopefully clear up the usage of types a bit:
;----------------------------------------------------------------------------------------------- ; define type ;----------------------------------------------------------------------------------------------- Type Block Field index Field x, y ;not used in this program End Type ;----------------------------------------------------------------------------------------------- ; create "Block"s ;----------------------------------------------------------------------------------------------- Print "Using 'New' command to create blocks" Print "====================================" Print ;11 times For i = 0 To 10 ;make new block b.Block = New Block ;set fields b\index = i b\x = Rand(800) b\y = Rand(600) ;print 'index' field Print b\index Next Print Print "press key.." WaitKey() Cls Locate 0, 0 ;----------------------------------------------------------------------------------------------- ; iterate through all blocks ;----------------------------------------------------------------------------------------------- Print "Using 'For..Each..Next' to show blocks" Print "======================================" Print ;loop through blocks For c.Block = Each Block ;the variable 'c' holds the current block Print c\index Next Print Print "press key.." WaitKey() Cls Locate 0, 0 ;----------------------------------------------------------------------------------------------- ; manually iterate through blocks ;----------------------------------------------------------------------------------------------- Print "Using 'First' and 'After' commands" Print "to find specific blocks" Print "==================================" Print ;get first block c.Block = First Block Print c\index ;get second block c = After c Print c\index ;get third block c = After c Print c\index ;get fourth block c = After c Print c\index Print Print "press key.." WaitKey() Cls Locate 0, 0 ;----------------------------------------------------------------------------------------------- ; delete block ;----------------------------------------------------------------------------------------------- Print "Using 'Delete' command to remove blocks" Print "=======================================" Print ;get first block c = First Block ;get fourth block c = After After After c ;delete block Delete c ;show blocks again For c.Block = Each Block Print c\index Next Print Print "press key.." WaitKey() Cls Locate 0, 0 ;----------------------------------------------------------------------------------------------- ; insert block ;----------------------------------------------------------------------------------------------- Print "Using 'Insert' command to change the blocks order" Print "=================================================" Print ;insert first block after last block 3 times Insert First block After Last Block Insert First block After Last Block Insert First block After Last Block ;show blocks again For c.Block = Each Block Print c\index Next Print Print "press key.." WaitKey() End