WINDOWS
Set a background pattern in a 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.
do something like this in your initialization function...
patRsrcNo = 5001
pat& = FN GETPIXPAT(patRsrcNo)
then when you get an update event for the window do something like this...
rgn& = [WINDOW(_wndPointer)+_visrgn]
CALL FILLCRGN(rgn&, pat&)
|