[BLACKBOX] Writing to text view while maintaining the focus
Hi all,
I have some small procedures for showing a text view and writing text to it programmatically.
Problem: after write access to the view and update the view gets the focus.
What should I do to have the focus not changed by writing to and updating the text view ?
Please find the involved procedures below:
TYPE
TerminalDesc* = LIMITED RECORD
width, height: INTEGER;
title: POINTER TO ARRAY OF CHAR;
f: TextMappers.Formatter;
m: TextModels.Model
END;
Terminal* = POINTER TO TerminalDesc;
PROCEDURE Create* (IN title: ARRAY OF CHAR; width, height: INTEGER): Terminal;
VAR
newObject: Terminal;
BEGIN
NEW (newObject);
newObject.width := width;
newObject.height := height;
NEW (newObject.title, LEN (title$) + 1);
newObject.title^ := title$;
newObject.m := TextModels.dir.New ();
newObject.f.ConnectTo (newObject.m);
RETURN newObject
END Create;
PROCEDURE Flush (terminal: Terminal);
VAR
pos: INTEGER;
c: Containers.Controller;
v: Views.View;
BEGIN
c := Containers.Focus ();
v := c.ThisView ();
Views.RestoreDomain (terminal.m.Domain ()); (* update display right now *)
pos := terminal.m.Length();
TextViews.ShowRange (terminal.m, pos, pos, TextViews.any); (* show end of text *)
TextControllers.SetCaret (terminal.m, pos); (* position cursor at end of text *)
c.SetFocus (v) (* maintain focus view prior to writing *)
END Flush;
Procedure Flush writes to and updates the text view. To restore the focus I added the bold lines but the last line traps.
Do I require to modify the bold lines ?
Would you recommend to use a totally different approach for writing and updating a text view just for logging purposes ?
Thanks in advance for any hints.
Best regards,
Rainer
---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy
Received on Mon Dec 05 2011 - 19:04:08 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:30:09 UTC