Bob Spelten wrote:
Dilwyn, thanks for your example.
Per's popup ended up in SuQcess. Wolfgang's sources revealed what I could
not get out of the EasyPtr manual.
We also pushed the MAWDRAW command to its limits in SuQcess, revealing
some bugs that were promptly dealt with by Marcel in the latest EasyPtr4.
But I must confess never to have used the MAWBAR command because MAWDRAW
does bars & arrows automagically.
Yes, indeed it does. When MAWDRAW is used to display an array, of course it
adds pan/scroll bars automatically as required. I only meant that if you
were using MAWBAR on app windows where there is no MAWDRAW menu present,
e.g. a graphics viewer.
I think I pestered Marcel a bit with the app window stuff and I rather think
he got a bit fed up of me finding obscure little oddities happending! Fair
play, Marcel has laboured long and hard with Easyptr to make it the great
programming tool that it is. Marcel never could resist a challenge ... :o))
Strictly speaking, the bars are drawn outside the Appl. Window and the
arrows inside it. EP4 will adjust the AW size to make room but anything
printed inside the AW must then be offset by 12 pixels from the left and 6
pixels from the top not to overwrite the arrows.
I never use the "arrows" drawn by MAWBARR, I find them too difficult to
handle and a little unpredictable in their actions. I did use them in an old
Graphics Viewer program, but programming was a real struggle, trying to
predict where and when bars and arrows would appear and the area of the
window I could use. In particular, when the graphics was only a few pixels
larger or smaller than the window. I can't remember the details, but after
that little saga I stopped using MAWBARR (my brain hurt).
I find it easier to use just pan/scroll bars without arrows, then either add
a couple of arrows as loose items outside the app window, or just scroll by
testing where the pointer is within the window (using PVAL), so that if you
click near the edges of a window, scrolling takes place. It is a bit fiddly
to program (see my BMP program or the Launchpad graphics viewer for example
of how it works) but easier than trying to use MAWBARR. Maybe I am not
understanding that command properly. Marcel has made some changes to MCALLT
in particular and even Albin Hessler had made some changes to how MAWBAR and
MAWBARR work, so you need the info in IMPORTANT_TXT on the Easyptr disk.
Here is how I pan and scroll by clicking on the window itself:
1) test for hit on the application window itself: action=MCALL(#channel):IF
action=1 THEN....
(when MCALL return is pure application window number 0,1,2...)
2) DIM r%(15):PVAL #channel,r% :REM get pointer result for this channel
3) Check if return was by mouse button press (r%(5)=1 or 2 for hit or do)
4) Check r%(3) and r%(4) for pointer position within window
5) if within, say, 10% of the edge as tested by r%(8) and r%(9) for width
and height of the window:
IF r%(3) < (r%(8)/10) THEN REM pan left (inside left hand 10% of window)
IF r%(3) > (9*r%(8)/10) THEN REM pan right (inside bottom 10% of window)
IF r%(4) < (r%(9)/10) THEN REM scroll up
IF r%(4) > (9*r%(9)/10) THEN REM scroll down
Obviously, be careful of where the horizontal and vertical strips overlap if
you don't want diagonal movement.
I managed to produce a simple SBASIC PIC viewer on the basis of your
example (I spotted 2 typos).
Err, yes, I spotted one (ph%), not even spotted the second myself yet!
I also added the arrows (MAWBARR) but the bar sections don't move when the
picture is moved with the arrows.
Do you know of any trick to make this happen?
No I don't, it's one of the reasons I hate MAWBARR because you can move a
few pixels by clicking on the arrows then you have to update the values of
the MAWBAR bars to make them reflect the new position. I find it too hard to
predict when the bars will disappear (if the entire picture fits inside the
window) and thus change the size of the viewable area. Hard to explain.
The other thing I find hard to handle is when you DO IIRC on a scroll bar
and split the sections, what to do with this when there is no menu (e.g. a
graphics viewer).
--
Dilwyn Jones
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm