[futurebasic] Re: [FB] How can I keep EditField background white?

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

From: "Osamu Shigematsu" <shige@...>
Date: Tue, 12 Jan 1999 21:22:09 +0900
Hi, Mel. Thank you for your advice.

I want to draw `FocusRing', which borders the active edit field.

I asked same question in other programming mail list and got an answer.
He says;

`Foucus Ring', or a border of the EditText can draw `DrawTgeneEditTextFrame'
fuction of Appearance Manager. Or, in case, you set focus to control using
`SetKeyboardFoucus', it will be handled automatically.

With Appearance 1.1 or later, you can get `GetThemeBrushAsColor' with
kTheBrushFocusHighlight, or set your own color using `SetThemeBrush'.

For more details:
http://developer.apple.com/techpubs/macos8/HumanInterfaceToolbox/humaninterf
acetoolbox.html
http://developer.apple.com/macos/8.5.html#toolbox

Tempolary, I write following routine with Mel's code.
Essentially, border color should be obtaim from Appearance Manager.

_darkenValue   = -16383
_lightenValue  =  16383

LOCAL MODE
LOCAL FN ShiftColor(@cPtr&,amt%) ' In Areal PANL.FLTR
  `     move.l  ^cPtr&,A0
  `     beq     exit               ; nil pointer check
  `     move.w  ^amt%,D2           ; set up remaining registers
  `     ext.l   D2
  `     moveq.w #2,D0              ; init loop count

  `startshiftloop
  `     clr.l   D1
  `     move.w  (A0),D1
  `     add.l   D2,D1              ; shift color value by amount

  `testlowerlimit
  `     cmpi.l   #0,D1             ; ck if d1 = 0
  `     bge     testupperlimit     ; if the value is OK, skip next check
  `     move.l  #0,D1              ; reset it to zero

  `testupperlimit
  `     cmpi.l  #$FFFF,D1          ; compare value to FFFF
  `     ble     endshiftloop       ; if the value is OK, skip next step
  `     move.l #$0000FFFF,D1       ; set it to max

  `endshiftloop
  `     move.w  D1,(A0)+           ; copy final value into destination
  `     dbra    D0,startshiftloop

  `exit
END FN

LOCAL
"Broder"
` dc.w $6666,$6666,$9999
LOCAL FN threeDFX(whichEF)
  DIM t,l,b,r
  DIM oldColor.rgbColor
  DIM bkColor.rgbColor
  DIM efH&
  LONG IF SYSTEM (_maxColors) >= 32
    CALL GETFORECOLOR (oldColor.red%)

    efH& = TEHANDLE (whichEF)
    LONG IF efH&
      t;8 = [efH&]
      CALL INSETRECT (t,-4,-4)

      CALL PENNORMAL
      LONG IF whichEF = WINDOW (_efNum)
        CALL RGBFORECOLOR (#LINE "Broder")
        CALL FRAMEROUNDRECT (t,4,4)
        CALL INSETRECT (t,1,1)
        CALL FRAMERECT (t)
      XELSE
        CALL GETBACKCOLOR (bkColor.red%)
        CALL RGBFORECOLOR (bkColor.red%)
        CALL FRAMEROUNDRECT (t,4,4)
        CALL INSETRECT (t,1,1)
        DEC (b) : DEC (r)
        FN ShiftColor(bkColor.red%,_lightenValue)
        CALL RGBFORECOLOR (bkColor.red%)
        PLOT r,t TO r,b TO l,b
        CALL GETBACKCOLOR (bkColor.red%)
        FN ShiftColor(bkColor.red%,_darkenValue)
        CALL RGBFORECOLOR (bkColor.red%)
        PLOT TO l,t TO r,t
      END IF
    END IF
    CALL RGBFORECOLOR (oldColor.red%)
  END IF
END FN