[BLACKBOX] New document view, different size

From: [at]} <Rainer>
Date: Fri, 21 Aug 2009 15:56:21 +0200

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

Hi all,
some times ago there was a question on the mailing list how to open a
new document window with size and height being different to the
standard values. I need this behaviour to display a couple of very
short lines of text and to free the user from having to manually
shrink down the window size.

A second topic on the list ("updating a text window") showed up how
to update the window in order to show the end of text.

So I tried to combine these infos into a little module.

Problem: the window containing some lines of text showes a strange
behaviour when being narrowed down manually until the window width is
smaller than the length of the lines. In this case an additional
blank line appears below every line of text exceeding the window
width. Of course these blank lines do not exist and will disappear
again when the window width is made large enougth to show the lines
of text in full length.

Could anybody please give me a hint how to avoid this behaviour ?
Please find my code below.

Thanks and best regards,
Rainer



MODULE TrialsNewWindow;

        IMPORT Containers, Documents, Ports, TextMappers, Models,
TextModels, TextViews, Views;

        VAR
        f: TextMappers.Formatter;
        m: TextModels.Model;
        v: TextViews.View;
        

        PROCEDURE Flush*;
        BEGIN
                Views.RestoreDomain (m.Domain ());
                TextViews.ShowRange (m, m.Length (), m.Length (), TextViews.any)
        END Flush;


        PROCEDURE OpenWindow*;
                VAR
                        d: Documents.Document;
                        c: Containers.Controller;
        BEGIN
                m := TextModels.dir.New ();
                f.ConnectTo (m);
                v := TextViews.dir.New (m);
                d := Documents.dir.New (v, 30 * Ports.mm, 60 * Ports.mm);
                c := d.ThisController ();
                c.SetOpts (c.opts + {Documents.winWidth} - {Documents.pageWidth});
                Views.OpenView (d)
        END OpenWindow;


        PROCEDURE WriteLn*;
        BEGIN
                Models.BeginModification (Models.clean, m);
                f.WriteLn;
                Models.EndModification (Models.clean, m);
                Views.RestoreDomain (m.Domain ());
                TextViews.ShowRange (m, m.Length (), m.Length (), TextViews.any)
        END WriteLn;

        PROCEDURE WriteString* (IN string: ARRAY OF CHAR);
        BEGIN
                Models.BeginModification (Models.clean, m);
                f.WriteString (string);
                Models.EndModification (Models.clean, m);
                Views.RestoreDomain (m.Domain ());
                TextViews.ShowRange (m, m.Length (), m.Length (), TextViews.any)
        END WriteString;

BEGIN
END TrialsNewWindow.


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-529807647_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhpIGFsbCxccGFyDQpzb21lIHRpbWVzIGFnbyB0
aGVyZSB3YXMgYSBxdWVzdGlvbiBvbiB0aGUgbWFpbGluZyBsaXN0IGhvdyB0byBvcGVuIGEgIFxw
YXINCm5ldyBkb2N1bWVudCB3aW5kb3cgd2l0aCBzaXplIGFuZCBoZWlnaHQgYmVpbmcgZGlmZmVy
ZW50IHRvIHRoZSAgXHBhcg0Kc3RhbmRhcmQgdmFsdWVzLiBJIG5lZWQgdGhpcyBiZWhhdmlvdXIg
dG8gZGlzcGxheSBhIGNvdXBsZSBvZiB2ZXJ5ICBccGFyDQpzaG9ydCBsaW5lcyBvZiB0ZXh0IGFu
ZCB0byBmcmVlIHRoZSB1c2VyIGZyb20gaGF2aW5nIHRvIG1hbnVhbGx5ICBccGFyDQpzaHJpbmsg
ZG93biB0aGUgd2luZG93IHNpemUuXHBhcg0KXHBhcg0KQSBzZWNvbmQgdG9waWMgb24gdGhlIGxp
c3QgKCJ1cGRhdGluZyBhIH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ZGlmaWNhdGlvbiAoTW9kZWxzLmNsZWFuLCBtKTtccGFyDQpcdGFiIFx0YWIgVmll
d3MuUmVzdG9yZURvbWFpbiAobS5Eb21haW4gKCkpO1xwYXINClx0YWIgXHRhYiBUZXh0Vmlld3Mu
U2hvd1JhbmdlIChtLCBtLkxlbmd0aCAoKSwgbS5MZW5ndGggKCksIFRleHRWaWV3cy5hbnkpXHBh
cg0KXHRhYiBFTkQgV3JpdGVTdHJpbmc7XHBhcg0KXHBhcg0KQkVHSU5ccGFyDQpFTkQgVHJpYWxz
TmV3V2luZG93LlxwYXINClxwYXINClxwYXINCi0tLS1ccGFyDQpUbyB1bnN1YnNjcmliZSwgc2Vu
ZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9YIiB0byBMSVNUU0VSVkBMSVNU
Uy5PQkVST04uQ0hccGFyDQp9
----boundary-LibPST-iamunique-529807647_-_---
Received on Fri Aug 21 2009 - 15:56:21 UTC

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