[futurebasic] Re: Button redraws & backgrnds with Jim's CDEF (revisited)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: Mel Patrick <mel@...>
Date: Tue, 18 Nov 1997 12:19:24 -0800
>OK, Mel & Staz, I tried to fix my code (mistake #1). The problem if you
>don't remember was that the buttons created with FB statements that
>utilize Jim's CDEFs (Mel knows) don't redraw properly when they're
>clobbered. Namely, they erase whatever pretty ppat is drawn for the
>window and use a white background instead. Mel, you may be of better
>help. Here's my update function that is called on the raw MacOS
>_updateEvt:
>
>LOCAL FN update (evtMessage&)
 AUTOCLIP = _FALSE:'
>        FN drawBackground (evtMessage&)
>        CALL DRAWCONTROLS (evtMessage&)
 AUTOCLIP = _TRUE
>END FN

might be one way to get around it...

You want to set the background pixel pattern :


      WINDOW -Wnd2Build,temp$,(L,T)-(R,B),_docNoGrow_noGoAway_noAutoClip
      FN SetBackPixelPattern(130)


LOCAL FN SetBackPixelPattern(thePixPat):'     sets window background pix pat
  LONG IF gcolorDepth>=4:'                 do we have some colours available
    ppat& = FN GETPIXPAT(thePixPat)
    LONG IF ppat&
      CALL GETPORT(thePort&)
      oldPixPat& = [thePort& + _bkPat]
      LONG IF oldPixPat&
        CALL DISPOSPIXPAT(oldPixPat&)
      END IF
      CALL BACKPIXPAT(ppat&)
    END IF
  END IF
END FN
'

I stopped using Jims CDefs in windows cause it was a pain to manage the
clipping. Plus I had to have two routines to handle clicks in the controls.
One low level (for trackcontrol and stuff), one normal FB style. I moved
them to dialogs.

I did manage to convert some of the controls to FB so it would handle the
control :

CLEAR LOCAL MODE
LOCAL FN UseCustomCDEF(theWndPtr&,butNum,theCNTL)
  theControl&=FN GETNEWCONTROL(theCNTL,theWndPtr&):'              CNTL resource
  LONG IF theControl&:'                        did we get the required resource
    rfCon&=FN GETCREFCON(theControl&):'               get the reference control
    rfCon&=((rfCon& AND &FFFF0000) OR (butNum<<16)):'            move to hiword
    CALL SETCREFCON(theControl&,rfCon&):'                         and set it up
    '   FB handles it from now on because the control number is in the highword
  END IF
END FN=theControl&

That way you can use FB's BUTTON and DIALOG statements. trouble is I forget
how I forced the cdef into fb button. I think I created a button, then
called the custom cdef routine. I should have made a copy when I had it
working...


Mel Patrick - theWabbitGuy - mel@...
http://www.intergate.bc.ca/business/mel