[Oberon] Oberon.Call

Paul Reed paulreed at paddedcell.com
Sun Feb 24 18:45:07 CET 2013


Hi Chris,

I apologise that I have not been able to clear the decks to respond to
this earlier.

> ] TextFrames.Edit is in turn called from the TextFrames message handler
> ] TextFrames.Handle().
> ----
> OK, but I still can't see how to get the char at the CURSOR.
> Is this correct:--
>   Oberon.GetSelection(text, beg, end, time);
>   char := <Scan 'text' from 'beg'>
> would get the char of mouse: RM.
>
> But the RECORD in Oberon.Mod which holds 'text' and 'beg'
>  has been Set by a process, which runs in the background,
>  which is not published.

It is! :)  The current (latest) selection is a conceptually-global
property of the system, which is obtained by Oberon.Mod using a
SelectionMsg broadcast in GetSelection().  Each viewer (e.g. a TextViewer)
with a selection will respond to this message in its handler and update
the selection in the message (as long as the selection time is later than
any selection already there).  See TextFrames.GetSelection().


> I want the CURSOR-chars, to be returned, for various keys, like they
> can be, for mouse: RM, via < Scan(GetSelected(args)) >.

There's a convention for many Oberon commands that in fact, only the
beginning of the text need be selected.  A simple example to look at would
be Edit.Locate, at the end of Chapter 5 of Project Oberon, page 174 (or
page 139 of the PDF), which:

1. finds the marked (starred) viewer, typically a source file being compiled
2. gets the current selection (usually in another viewer, the log viewer,
a pos of a compile error)
3. opens a scanner S at the start of the current selection (after this,
what text is *actually* selected is ignored)
4. scans until it finds an integer (a position), returned in S.i
5. shows that position in the marked viewer, by repositioning the Text
frame (found in 1.) to 200 characters beforehand
6. puts the focus and the caret in the marked viewer at position S.i


> The difficult part, is that the <text stream viewed on the screen/display>
> consists of differnt sized rectangles.

Yes, and each viewer has the choice to lay out text however it wants
(there's text in the graphics editor too, for example).


> It seems to me that there can be no 'mapping' from X,Y to the
> correspondingly
> displayed-char. Because eg. if you change the font-size of charN, then the
> X,Y of char (n + i) changes.

Quite.  Hence the message broadcast, so that each viewer can interpret its
own contents.


> I'm not getting near a solution.

Hopefully the above helps a bit.  If you really want the text at the
*mouse* cursor, you could add a new message type and add a handler for
that message type to each type of window which displays text.  Or perhaps
at least add a new message id to ControlMsg.  In later systems YMMV.

But you'd be changing the convention on how the system is used, since the
selection is the established way to get things like this done.  And in any
case I'm not sure what you actually want to do! :)

Cheers,
Paul





More information about the Oberon mailing list