On 18/09/2007, at 12:52 PM, Yoshiyuki Hasegawa wrote: > Hi, > > On 2007/08/31, at 1:37, Rich Love wrote: > >> OK, I figured it out. >> >> LOCAL FN GetButtonFocus >> dim @focusC as ControlRef >> dim TheButton as int >> err = fn GetKeyBoardFocus( window(_wndref), focusC) >> TheButton = fn FBgetControlRef( focusC ) >> END FN = TheButton >> >> PRINT "The current appearance text field selected is " FN >> GetButtonFocus >> > > Error on FBtoC. > > ･･ Unknown function in line 950 of BoxSizeCalculator: > FBgetControlRef > 950: edtFldID = fn FBgetControlRef( focusControl ) > > What is the substitution of FBgetControlRef? BtnNumFromControlRef works in both FB and FBtoC. /* Given a ControlRef or HIViewRef, return the FB btnNum (0 if it is not an FB control) */ local fn BtnNumFromControlRef( c as ControlRef ) '~'1 dim as ControlID cID dim as long btnNum #if ndef _FBtoC btnNum = fn FBgetControlRef( c ) #else _kFBtoCAppSignature = _"FB>C" btnNum = 0 long if ( fn GetControlID( c, @cID ) == _noErr ) if ( cID.signature == _kFBtoCAppSignature ) then btnNum = cID.id end if #endif end fn = btnNum window 1 appearance button 99,,,,, "", (20,20)-(120,40), _kControlPushButtonProc dim as long btnNum dim as ControlRef c c = button&( 99 ) // get ControlRef from btnNum in output window btnNum = fn BtnNumFromControlRef( c ) stop str$( btnNum ) Robert P.