Page 1 of 1

NewList or List in a Structure how to declare and using ?

Posted: Mon Jul 15, 2024 6:50 am
by hdt888
Hi, I am new to PB.

How to declare New List, List in a struct.

It is better to have an example of how to use Procedure inside and outside.

Thank man.

Re: NewList or List in a Structure how to declare and using ?

Posted: Mon Jul 15, 2024 7:13 am
by infratec

Code: Select all

structure ListExample_Structure
  List ListExample.i()
endstructure
That's all.
NewList is not involved.

Re: NewList or List in a Structure how to declare and using ?

Posted: Mon Jul 15, 2024 10:32 pm
by mk-soft
And ...

Code: Select all

Structure ListExample_Structure
  List ListExample.i()
EndStructure

; Then ...

Global ListData.ListExample_Structure

; Or ...

*mem1 = AllocateStructure(ListExample_Structure)
; ...
FreeStructure(*mem1)

; Or ...

*mem2 = AllocateMemory(SizeOf(ListExample_Structure))
InitializeStructure(*mem2, ListExample_Structure)
; ...
ClearStructure(*mem2, ListExample_Structure)
FreeMemory(*mem2)