Code: Alles auswählen
If MyList()\xyz = #True And MyList()\Prev\xyz = #True And MyList()\Prev\Prev\xyz = #True
EndIf
Ich hab nun ein wenig herumgespielt und bin auf folgenden Code gekommen, der die Pb-eigenen Links verwendet. Damit entfällt die Gefahr bei der Wartung der eigenen Links und es wird auch kein zusätzlicher Speicher in der List benötigt.
Code: Alles auswählen
CompilerIf 0
Structure MYSTRUC
*NextItem.MYSTRUC[0]
*PrevItem.MYSTRUC[0]
Text1$
Text2$
x.i
y.i
z.i
EndStructure
CompilerElse
Macro _MYSTRUC
Text1$
Text2$
x.i
y.i
z.i
EndMacro
Structure MYSTRUC
*NextPrevItem.MYSTRUC_EX[0]
_MYSTRUC
EndStructure
Structure MYSTRUC_EX
*NextItem
*PrevItem
*NextPrevItem.MYSTRUC_EX[0]
_MYSTRUC
EndStructure
Macro NextItem : NextPrevItem[-2] : EndMacro
Macro PrevItem : NextPrevItem[-1] : EndMacro
CompilerEndIf
Debug ""
Debug "==== CREATE LIST ====="
Debug ""
NewList MyList.MYSTRUC()
AddElement (MyList()) : MyList()\Text1$ = "Element1" : MyList()\x = 111
AddElement (MyList()) : MyList()\Text1$ = "Element2" : MyList()\x = 222
AddElement (MyList()) : MyList()\Text1$ = "Element3" : MyList()\x = 333
Debug ""
Debug "==== EXAMPLE 1 ====="
Debug ""
FirstElement (MyList())
NextElement (MyList())
Debug "" + MyList()\x + " - " + MyList()\PrevItem\Text1$ + " - " + MyList()\PrevItem\x
Debug "" + MyList()\x + " - " + MyList() \Text1$ + " - " + MyList() \x
Debug "" + MyList()\x + " - " + MyList()\NextItem\Text1$ + " - " + MyList()\NextItem\x
Debug ""
Debug "==== EXAMPLE 2 ====="
Debug ""
FirstElement (MyList())
Debug MyList() \Text1$
Debug MyList()\NextItem\PrevItem\Text1$
Debug MyList()\NextItem \Text1$
Debug MyList()\NextItem\NextItem\Text1$