[BLACKBOX] Play file = Automatic scrolling

From: Douglas G. Danforth <"Douglas>
Date: Thu, 24 Apr 2008 21:14:08 -0700

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

Ok, I give up.

I have tried to follow the documentation and the code
and end up chasing my tail.

Here is what I want to do (under a deadline to get it done).
Play a large jpg file. By play I mean have is slowly scroll horizontally
from the beginning to end.

This can easily be done with the current 'thumb' scroll bar when the
file is opened BUT this needs to be done from 'underneath', by the
program when a 'Play' button is pushed.

I can see the 'Restore' code for the implementation of FreeImage in
BlackBox.

I can even get a crude form of scrolling to happen by using a
Services.Action
coupled with f.SetOffset(gx, gy) for a frame f. BUT something else is
missing
since when I do that the image does indeed scroll to the left but the
right hand
side is not refreshed. It IS refreshed if one uses the 'thumb' scroll bar.

Hence I would like to emulate (in some manner) the action of mouse down
over the
scroll bar and moving it.

Nowhere in the Free/Mod/ software is there any handling of
Controls.PollSectionMsg
and yet it still does the right thing when the thumb scroll bar is
moved. How does it
know this? The Restore code knows about f.gx, f.gy and
f.context.GetSize(x, y);

Here it is

    PROCEDURE RestorePicture* (v: View; f: Views.Frame);
        VAR
            res: INTEGER;
            dc, dc1: WinApi.HDC;
            w, h: INTEGER;
    BEGIN

        v.context.GetSize(w, h);

        dc := f.rider(HostPorts.Rider).port.dc; (* Actual dc *)
        dc1 := WinApi.CreateCompatibleDC(dc);
        res := WinApi.SelectObject(dc1, v.bmp);
        f.rider(HostPorts.Rider).DrawBitmap(dc1, v.w, v.h, f.gx, f.gy,
w, h);

        res := WinApi.DeleteDC(dc1)

    END RestorePicture;

    (* To display the imported picture in a stand-alone view *)
    PROCEDURE (v: View) Restore* (f: Views.Frame; l, t, r, b: INTEGER);
    BEGIN
        IF v.bmp # 0 THEN
            RestorePicture(v, f)
        END
    END Restore;


The values of v.w and v.h are set when the image file is opened and not
changed there after.
Since I can change f.gx and f.gy and get only partially the correct
answer it says to me that
v.context.GetSize(w,h) is returning values that are not set up correctly
and yet this (above) is the
one and only place where the v.context is mentioned in all the Mod files.

This is much too low level. I had hoped that BB had a one-to-one
correspondence for every
control to a programatic representation of that control so that there
would be something like
view.MoveHScrollBarTo(x) and it would be exactly as if the user moved
the Horizontal
Scroll Bar to position x (with all of the consequences there of).

Does anyone have any ideas of how to do this without me reimplementing
the Restore code?

-Doug Danforth


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-101494924_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIE9rLCBJIGdpdmUgdXAuXHBhcg0KXHBhcg0KSSBo
YXZlIHRyaWVkIHRvIGZvbGxvdyB0aGUgZG9jdW1lbnRhdGlvbiBhbmQgdGhlIGNvZGVccGFyDQph
bmQgZW5kIHVwIGNoYXNpbmcgbXkgdGFpbC5ccGFyDQpccGFyDQpIZXJlIGlzIHdoYXQgSSB3YW50
IHRvIGRvICh1bmRlciBhIGRlYWRsaW5lIHRvIGdldCBpdCBkb25lKS5ccGFyDQpQbGF5IGEgbGFy
Z2UganBnIGZpbGUuICBCeSBwbGF5IEkgbWVhbiBoYXZlIGlzIHNsb3dseSBzY3JvbGwgaG9yaXpv
bnRhbGx5XHBhcg0KZnJvbSB0aGUgYmVnaW5uaW5nIHRvIGVuZC5ccGFyDQpccGF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ZXZlbC4g
IEkgaGFkIGhvcGVkIHRoYXQgQkIgaGFkIGEgb25lLXRvLW9uZSBccGFyDQpjb3JyZXNwb25kZW5j
ZSBmb3IgZXZlcnlccGFyDQpjb250cm9sIHRvIGEgcHJvZ3JhbWF0aWMgcmVwcmVzZW50YXRpb24g
b2YgdGhhdCBjb250cm9sIHNvIHRoYXQgdGhlcmUgXHBhcg0Kd291bGQgYmUgc29tZXRoaW5nIGxp
a2VccGFyDQp2aWV3Lk1vdmVIU2Nyb2xsQmFyVG8oeCkgYW5kIGl0IHdvdWxkIGJlIGV4YWN0bHkg
YXMgaWYgdGhlIHVzZXIgbW92ZWQgXHBhcg0KdGhlIEhvcml6b250YWxccGFyDQpTY3JvbGwgQmFy
IHRvIHBvc2l0aW9uIHggKHdpdGggYWxsIG9mIHRoZSBjb25zZXF1ZW5jZXMgdGhlcmUgb2YpLlxw
YXINClxwYXINCkRvZXMgYW55b25lIGhhdmUgYW55IGlkZWFzIG9mIGhvdyB0byBkbyB0aGlzIHdp
dGhvdXQgbWUgcmVpbXBsZW1lbnRpbmcgXHBhcg0KdGhlIFJlc3RvcmUgY29kZT9ccGFyDQpccGFy
DQotRG91ZyBEYW5mb3J0aFxwYXINClxwYXINClxwYXINCi0tLS1ccGFyDQpUbyB1bnN1YnNjcmli
ZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9YIiB0byBMSVNUU0VS
VkBMSVNUUy5PQkVST04uQ0hccGFyDQp9
----boundary-LibPST-iamunique-101494924_-_---
Received on Fri Apr 25 2008 - 06:14:08 UTC

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