RE: [BLACKBOX] Writing to text view while maintaining the focus

From: null <">
Date: Thu, 08 Dec 2011 09:21:39 +0000

----boundary-LibPST-iamunique-1173748948_-_-
Content-type: text/plain

Hallo,

since nobody replies ... It is not really clear to me, why your program
fragment hits a "precondition violated trap 22", to be honest, I don't
have any idea what this precondition means:
        focus.context.ThisModel() = c.ThisModel()

But: you could give Martin Fishers Output a try. Iit is available from
CPC (see http://zinnamturm.eu/downloadsOS.htm#Output) and it appears to
me that it should provide what you are trying to solve ...

regards
--
  Bernhard Treutwein
  Ludwig-Maximilians-Universität
  Ref. VI.3 Anwendungsbetreuung
  Martiusstr. 4/I Raum 107
  80802 München
  Tel. 089 2180-2774
  Fax. 089 2180-992774
  Mobil. 0152-01549335
  e-mail: bernhard treutwein (at) verwaltung uni-muenchen de
 
> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy> Rainer Neubauer
> Sent: Monday, December 05, 2011 7:04 PM
> To: BLACKBOX{([at]})nowhere.xy> Subject: [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> 
----boundary-LibPST-iamunique-1173748948_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBIYWxsbyxccGFyDQpccGFyDQpz
aW5jZSBub2JvZHkgcmVwbGllcyAuLi4gSXQgaXMgbm90IHJlYWxseSBjbGVhciB0byBtZSwgd2h5
IHlvdXIgcHJvZ3JhbVxwYXINCmZyYWdtZW50IGhpdHMgYSAicHJlY29uZGl0aW9uIHZpb2xhdGVk
IHRyYXAgMjIiLCB0byBiZSBob25lc3QsIE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AtLS0tIFRv
IHVuc3Vic2NyaWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05PRkYgXHBhcg0KPiBC
TEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIfX0AYld4eWRHWWcKWEd4cA==
----boundary-LibPST-iamunique-1173748948_-_---
Received on Thu Dec 08 2011 - 10:21:39 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:09 UTC