Re: [BLACKBOX] Views - Size at opening

From: [at]} <Robert>
Date: Sat, 31 Mar 2012 08:31:56 +0100

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

There are three abstractions:

- Simple Views
- Documents, which form a root to a general View hierarchy
- Windows, which allow 1 or more Documents to be visible on screen.

In general one wants separate control over each's size; for example when
a Window is resized it is optional if its Document is resized to fit the Window,
to fit the printer page, or fixed.

In your case I suspect that you want all 3 to be the same, but you should not
expect that to happen just by setting any one, the situation is much more
versatile than that.


To resize a View does one need more than a simple:

    v.context.SetSize(w, h)?

I don't expect that to change the size of a Window, or of the View's immediate
Container - which may be a Document.



To make an already open Window resize I have resorted to:


PROCEDURE SetWindowPlacement* (IN title : Views.Title; x, y, w, h : INTEGER);
   VAR
     win : Windows.Window;
     wTitle : Views.Title;
     wnd : WinApi.HWND;
     ret : WinApi.BOOL;
     wp : WinApi.WINDOWPLACEMENT;
   BEGIN
     win := Windows.dir.First ();
     WHILE win # NIL DO
       win.GetTitle (wTitle);
       IF wTitle = title THEN
         wnd := win(HostWindows.Window).wnd;
         IF (w = 0) & (h = 0) THEN
           ret := WinApi.GetWindowPlacement (wnd, wp);
           w := wp.rcNormalPosition.right - wp.rcNormalPosition.left;
           h := wp.rcNormalPosition.bottom - wp.rcNormalPosition.top
         END;
         ret := WinApi.MoveWindow (wnd, x, y, w, h, 1);
         RETURN
       END;
       win := Windows.dir.Next (win)
     END
   END SetWindowPlacement;

There is probably a simpler way?


Regards

Robert


On 31/03/2012 01:17, Douglas G. Danforth wrote:
> Folks,
>
> Here is an even simpler way to change the size of a view (a text view in this case)
>
> view := TextViews.dir.New(text);
> Views.OpenAux(view, title);
> win :=Windows.dir.First();
> win.SetSize(w, h);
>
> This requires that 'Windows' be used in addition to the pointer to the view you
> are given.
>
> -Doug Danforth
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.1913 / Virus Database: 2114/4904 - Release Date: 03/30/12
>
> ---- To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
> LISTSERV{([at]})nowhere.xy
>


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1484908657_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFRoZXJlIGFyZSB0aHJlZSBhYnN0cmFjdGlvbnM6
XHBhcg0KXHBhcg0KLSBTaW1wbGUgVmlld3NccGFyDQotIERvY3VtZW50cywgd2hpY2ggZm9ybSBh
IHJvb3QgdG8gYSBnZW5lcmFsIFZpZXcgaGllcmFyY2h5XHBhcg0KLSBXaW5kb3dzLCB3aGljaCBh
bGxvdyAxIG9yIG1vcmUgRG9jdW1lbnRzIHRvIGJlIHZpc2libGUgb24gc2NyZWVuLlxwYXINClxw
YXINCkluIGdlbmVyYWwgb25lIHdhbnRzIHNlcGFyYXRlIGNvbnRyb2wgb3ZlciBlYWNoJ3Mgc2l6
ZTsgZm9yIGV4YW1wbGUgd2hlblxwYXINCmEgV2luZG93IGlzIHJlc2l6ZWQgaXQgaXMgb3B0aW9u
YWwgaWYgaXRzIERvY3VtZW50IGlzIHJlc2l6ZWQgdG8gZml0IHRoZSBXaW5kb3csXHBhcg0KdG8g
Zml0IHRoZSBwcmludGVyIHBhZ2UsIG9yIGZp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HkgIlNJR05PRkYgQkxBQ0tCT1giIHRvIExJU1RTRVJWQExJU1RTLk99fQBAZ3JlZW53b29k
ZmE=
----boundary-LibPST-iamunique-1484908657_-_---
Received on Sat Mar 31 2012 - 09:31:56 UTC

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