So, while loading you have to properly allocate your pointer data structure again with NEW.
Hi, I have recoded in revised Oberon so far, Dialogs.Mod, Dialog.Mod, DialogFrames.Mod, Display1.Mod, In.Mod, ... I am testing on `Test.Dlg', trying to understand `Dlg' file structure, just by opening it. Dialog.Open Test.Dlg ~ which fails on `h' TRAP 1 in `Dialogs.Mod', index out of range I guess. PROCEDURE LoadP (p: Panel; VAR r: Files.Rider); (** reads the panel from rider r *) VAR cnt, end1, end2, h: INTEGER; o, prev: Object; module: Modules.ModuleName; name: ARRAY 32 OF CHAR; tab1: ARRAY maxItems OF Modules.ModuleName; tab2: ARRAY maxItems OF ARRAY 32 OF CHAR; pos: LONGINT; BEGIN p.contents := NIL; prev := NIL; Files.ReadInt(r, cnt); (*COPY ("", p.cmd)*) p.cmd[0] := 0X; end1 := 0; end2 := 0; WHILE cnt # 0 DO DEC (cnt); pos := Files.Pos (r); Files.ReadInt (r, h); IF h < end1 THEN module := tab1[h] ELSE Files.Set (r, Files.Base (r), pos); Files.ReadString (r, module); tab1[end1] := module; INC (end1) END; pos := Files.Pos (r); Files.ReadInt (r, h); IF h < end2 THEN (*COPY (tab2[h], name)*) name := tab2[h]; ELSE Files.Set (r, Files.Base (r), pos); Files.ReadString (r, name); (*COPY (name, tab2[end2]);*) tab2[end2] := name; INC (end2) END; (** TODO load module and let it init itself instead using Types.Mod *) (*Types.NewObj (o, Types.This (Modules.ThisMod (module), name)); ASSERT (o # NIL);*) NEW(o); ASSERT (o # NIL); Init(o); o.do.Load (o, r); o.panel := p; IF prev # NIL THEN prev.next := o ELSE p.contents := o END; prev := o END; Files.ReadString (r, p.cmd); p.do.Restore (p) END LoadP; Dumping `Test.Dlg'... 00000000 05 00 44 69 61 6c 6f 67 42 75 74 74 6f 6e 73 00 |..DialogButtons.| 00000010 49 74 65 6d 44 65 73 63 00 50 72 69 6e 74 00 4d |ItemDesc.Print.M| 00000020 79 45 64 69 74 2e 50 72 69 6e 74 00 00 00 81 29 |yEdit.Print....)| 00000030 00 e0 5e f8 ff 80 1a 06 00 40 0d 03 00 00 53 79 |..^......@....Sy| 00000040 6e 74 61 78 31 30 2e 53 63 6e 2e 46 6e 74 00 44 |ntax10.Scn.Fnt.D| 00000050 69 61 6c 6f 67 53 74 61 74 69 63 54 65 78 74 73 |ialogStaticTexts| 00000060 00 49 74 65 6d 44 65 73 63 00 44 72 61 66 74 00 |.ItemDesc.Draft.| 00000070 00 00 30 df 18 00 00 ad f8 ff 80 1a 06 00 40 0d |..0...........@.| 00000080 03 00 00 01 01 00 53 79 6e 74 61 78 31 30 2e 53 |......Syntax10.S| 00000090 63 6e 2e 46 6e 74 00 64 72 61 66 74 00 44 69 61 |cn.Fnt.draft.Dia| 000000a0 6c 6f 67 43 68 65 63 6b 42 6f 78 65 73 00 49 74 |logCheckBoxes.It| 000000b0 65 6d 44 65 73 63 00 64 72 61 66 74 00 00 00 20 |emDesc.draft... | 000000c0 0b 20 00 f0 85 f8 ff 40 0d 03 00 40 0d 03 00 00 |. .....@...@....| 000000d0 01 00 49 74 65 6d 44 65 73 63 00 46 69 6c 65 00 |..ItemDesc.File.| 000000e0 00 00 a0 86 01 00 10 d4 f8 ff 80 1a 06 00 40 0d |..............@.| 000000f0 03 00 00 01 01 00 53 79 6e 74 61 78 31 30 2e 53 |......Syntax10.S| 00000100 63 6e 2e 46 6e 74 00 66 69 6c 65 00 44 69 61 6c |cn.Fnt.file.Dial| 00000110 6f 67 54 65 78 74 73 00 49 74 65 6d 44 65 73 63 |ogTexts.ItemDesc| 00000120 00 66 69 6c 65 00 00 00 40 ef 07 00 00 ad f8 ff |.file...@.......| 00000130 60 ae 0a 00 60 5b 03 00 00 00 |`...`[....| 0000013a -- Tomas Kral <thomas.kral@email.cz>