On Thu, 13 Dec 2018 22:13:43 +0100 Tomas Kral <thomas.kral@email.cz> wrote:
Fun when I try to add some message loop (handler), as I do not understand this part much.
I have copied over `Handler' code from `GraphicFrames.Mod', and skinned it to a bare skeleton. It seems that to tap into Oberon event loop, one needs to extend `DisplayFrame' and install own `Handle'. It seems to avoid circular references, there is a need of three modules, Main, Control, and Frame. Possibly the concept of MVC, as noted in OOP by H.P.Mossenbock. I am now able to clear frame, on opening and resizing, plus calling Update to draw DLog elements. How do I clear frame only on initial opening not closing or resizing? Note actual M.Y, M.H, has to be picked from the frame message! I do not get(*understand*) all the other events, except `Oberon.InputMsg'. What if, I needed to add a new handler for each `DLog' element at runtime, how do I chain all handlers then? Frame* = POINTER TO FrameDesc; FrameDesc* = RECORD (Display.FrameDesc) END ; UpdateMsg = RECORD (Display.FrameMsg) id: INTEGER; END ; PROCEDURE Handle*(F: Display.Frame; VAR M: Display.FrameMsg); VAR x, y, h: INTEGER; BEGIN CASE F OF Frame: CASE M OF Oberon.InputMsg: IF M.id = Oberon.track THEN x := M.X; y := M.Y; IF M.keys # {} THEN ELSE Oberon.DrawMouse(MyMouse, x, y) END ELSIF M.id = Oberon.consume THEN END | UpdateMsg: (*my update, not sure what to do here*) | Oberon.ControlMsg: IF M.id = Oberon.neutralize THEN Oberon.RemoveMarks(F.X, F.Y, F.W, F.H); Out.String("neutralize msg"); Out.Ln ELSIF M.id = Oberon.defocus THEN END | Oberon.SelectionMsg: Out.String("select msg"); Out.Ln | Oberon.CopyMsg: Oberon.RemoveMarks(F.X, F.Y, F.W, F.H); | MenuViewers.ModifyMsg: Out.String("modify msg"); Out.Ln; Display.ReplConst(Display.black, F.X, M.Y, F.W, M.H, Display.replace); (*clear frame*) DLogs.Update (*redrawing dialog screen*) END END END Handle; -- Tomas Kral <thomas.kral@email.cz>