[comp.sys.mac.apps] QuickBasic Window Refresh - Method?

linneweh@motcid.UUCP (Louis Linneweh) (11/17/90)

I use  Microsoft's QuickBasic language for quick, individual programs with
old-fashioned, scrolling, cheap and dirty output.  Just the kind of thing
a language named "QuickBasic" should be good at.  But the output window is
frequently overwritten by other windows (Mail, Smart Alarms, even QuickBasic
error messages!) and when you return to the output window, low an behold,
the overwritten portion is not refreshed.  Not only is work lost, but if
the culprit was the error message you've also lost the details of the 
results preceeding the error!  Writing code to redo the work and display it
again would not even be able to help this last example, and the amount of
effort required flies in the face of *QuickBasic*.

Am I just missing an option somewhere that would make "refresh" automatic,
or am I the victim of Microsoft's desire to give the user full control
over the Mac window interface?  I'd even add a little code to trigger a 
refresh if I didn't have to redo the entire calculation (which may have
taken some minutes in the first place).  Is there a reasonable way to do
this?  Do I need to maintain my own scrolling buffer and reprint it?

BTW, Microsoft couldn't seem to help me with this.  It may be *the* reason
to find another language! 

awessels@ccwf.cc.utexas.edu (Allen Wessels) (11/17/90)

In article <5339@blue.UUCP> linneweh@motcid.UUCP (Louis Linneweh) writes:
>I use  Microsoft's QuickBasic language for quick, individual programs with
>old-fashioned, scrolling, cheap and dirty output.  Just the kind of thing
>a language named "QuickBasic" should be good at.  But the output window is
>frequently overwritten by other windows (Mail, Smart Alarms, even QuickBasic
>error messages!) and when you return to the output window, low an behold,
>the overwritten portion is not refreshed.  Not only is work lost, but if
>the culprit was the error message you've also lost the details of the 
>results preceeding the error!  Writing code to redo the work and display it
>again would not even be able to help this last example, and the amount of
>effort required flies in the face of *QuickBasic*.

If you store the results of the calculations, you won't lose them.  Your best
bet is to trap the errors with the ON ERROR statement.  

Quick is a relative term.  I've used QuickBASIC to do lots of quick and dirty
programs and it suits my purposes just fine.  If you can't design your program
within the QuickBASIC/Mac framework, I'd suggest either printing
out your intermediate results, or look at a different programming environment.
You might look at HyperCard. 

>Am I just missing an option somewhere that would make "refresh" automatic,

Nope, it isn't there.

>or am I the victim of Microsoft's desire to give the user full control
>over the Mac window interface?  I'd even add a little code to trigger a 
>refresh if I didn't have to redo the entire calculation (which may have
>taken some minutes in the first place).  Is there a reasonable way to do
>this?  Do I need to maintain my own scrolling buffer and reprint it?

Assuming you have stored the results of your calculations and trap errors, it
is pretty easy to check to see if the window has been overwritten and have 
the program redraw it.  I don't have my manual handy and I haven't written the
code to do this often enough to post an example.  There should be enough leads
in the section that talks about handling windows to track this down easily.

>BTW, Microsoft couldn't seem to help me with this.  It may be *the* reason
>to find another language! 

You might check out ZBASIC, and you might also try and find a copy of the 
current MacWEEK or InfoWorld.  There is an article in one of these (MacWEEK, I
think) that describes a new magazine for BASIC users on the Mac.

mxmora@unix.SRI.COM (Matt Mora) (11/21/90)

In article <5339@blue.UUCP> linneweh@motcid.UUCP (Louis Linneweh) writes:

One of the best ways to do this is using the GET , PUT statements
to save your window contents in an offscreen buffer. I use this in
a lot of the basic programs I wrote. After I would draw the window contents,
I would copy the window to the offscreen buffer. If an update event occurs
then you just blast the image back into the window. I works great and fast.
Its backwards to the way you should do it but until I release my Offscreen
support libraries for Quickbasic there is no other way. One problem in the
above method is that is doesn't copy color information. 




-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________