[futurebasic] Re: windows and background patterns

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1998 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Thu, 01 Jan 1998 11:26:11 +0000
Mike Friedman wrote:
> 
> What would be the best way to put a simple background pattern in a window
> (non PG project).  I assume I would do this with a ppat, but how do i
> attach a specific ppat to the window?

You use GETPIXPAT to get a properly-formatted handle to the ppat
resource's data, and you use BACKPIXPAT to attach it to the current
window.  For example, the following fills a window with your desktop's
pattern (which is System ppat #16):

WINDOW 1
ppatH& = FN GETPIXPAT(16)  '16 = desktop ppat
IF ppatH& THEN CALL BACKPIXPAT(ppatH&) ELSE BEEP
CLS  'This "Refreshes" the background
DO
  HANDLEEVENTS
UNTIL 0

Inside Mac says you should not dispose of ppatH& after calling
BACKPIXPAT, because the window uses it, and that the system disposes of
it for you when you close the window.  It is not clear what you should
do if you _switch_ from one pattern to another while the window's still
open--I would think that in that case you ought to explicitly dispose of
the (old) ppat handle after switching.

- Rick