[Oberon] FPGA - OberonV4 Dialogs

Tomas Kral thomas.kral at email.cz
Mon Nov 26 12:10:26 CET 2018


Hi,

I am now recoding `Dialog Texts' which is one of the item type
descendants from `Dialog Objects'.

It inherits methods from Dialogs plus it adds some of its own.

IMethods* = POINTER TO IMDesc;

IMDesc* = RECORD (Dialogs.OMDesc) (*base object method descriptor*)
  (*Copy*: PROCEDURE(t: Item; VAR dup: Dialogs.Object);*) (*override*)
  GetText*: PROCEDURE(t: Item): Texts.Text;
  SetSelection*: PROCEDURE(t: Item; beg, end: LONGINT);
  RemoveSelection*: PROCEDURE(t: Item);
  (*Draw*: PROCEDURE(t: Item; x, y: INTEGER; f: Display.Frame);*) (*override*)
  (*Print*: PROCEDURE(t: Item; x, y: INTEGER);*) (*not implemented*)
  (*Handle*: PROCEDURE(t: Item; f: Display.Frame; VAR msg: Display.FrameMsg);*) (*override*)
END;

ItemDesc* = RECORD (Dialogs.ObjectDesc)
  f: TextFrames.Frame;
END;

VAR m (*self*), m0 (*base*):  IMethods;
  t: Item; o: Object;
...

To call (base) object methods I do e.g.
t.do.GetDim (t, x, y, w, h);
t.do.Draw (t, f.X + x, f.Y + f.H + y, f);

To call (self) item specific methods I do e.g.
CASE o OF Item: t1 := o(*Item*).do(IMethods).GetText (o(*Item*));
It seems that without `CASE' I need to do more typeguarding.

The above compiles, not sure if alright though. However, I seem unable to clone m and initialise m0, with base methods' pointers.

Dialogs.Clone(m:(*self Dialogs.OMethods*));
Dialogs.Get(m0:(*base Dialogs.OMethods*));

I just need `do*:' pointing to a descriptor holding base pointers plus new methods pointers.

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list