[futurebasic] Re: [FB] Tab key detection

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2003 : Group Archive : Group : All Groups

From: Jay Reeve <jayreeve@...>
Date: Thu, 12 Jun 2003 22:05:27 -0500
>  > Are you using a Filter FN...
>
>No, just a plain old event loop, based on PG but with all of the non-Carbon
>stuff stripped out:
>
>ON BREAK      GOSUB "PG:Chk Break"
>ON DIALOG     GOSUB "PG:Dialog"
>ON EDIT       GOSUB "PG:TEKey"
>ON EVENT      GOSUB "PG:Event"
>ON MENU       GOSUB "PG:Menu"
>ON MOUSE      GOSUB "PG:Mouse"
>ON TIMER(-10) GOSUB "PG:Timer"
>ON STOP       GOSUB "PG:Stop"
>
>But no tab key events get sent to me through any of the appropriate subs. (I
>put DEF DEBUGSTRING statements in each of the above subs and got nothing
>when the tab key was pressed.)
>
>If there are multiple fields in the window, the focus switches appropriately
>from field to field when the user presses the tab key, but there's nothing
>in my code that's handling that, so it must be something the runtime is
>doing for me.
>
>I just looked through RnTm Appearance.Incl, and found the following section
>of code, which looks like the runtime is indeed handling the tab keys. The
>question then becomes, is there a clever way to selectively override this
>behavior? It's great in most cases, but not in every window of my
>application. I hate modifying the runtime, as it makes moving to the next
>version of FB awfully messy.
>
>-------------------------------------------------------------------
>long if theChar == _fbTabKey // Tab & Shift-Tab
>autoTabEFs = _zTrue
>wRefCon = fn GetWRefCon( w )
>if fn IsWRefConFBHandle( wRefCon ) then autoTabEFs = (
>wRefCon..FBwNoAutoFocus == _false )
>long if autoTabEFs // automatically move focus
>long if ev.modifiers and _shiftKey%
>err = fn ReverseKeyboardFocus( w )
>xelse
>err = fn AdvanceKeyboardFocus( w )
>end if
>err = fn GetKeyBoardFocus( w, newFocusC )
>
>//err = fn ActivateControl( newFocusC ) // this magically prevents the OS X
>EF-frame-darkening
>
>long if newFocusC != focusC // focus changed
>fn SendFBDialogEvt( _efSelected, fn FBgetControlRef( newFocusC ) ) // new EF
>id, or 0
>end if
>
>xelse // send _efTab/_efShiftTab event
>
>long if ev.modifiers and _shiftKey%
>fn SendFBDialogEvt( _efShiftTab, cNum )
>xelse
>fn SendFBDialogEvt( _efTab, cNum )
>end if
>
>end if
>exit fn
>end if
>-------------------------------------------------------------------
>
>-- John

John,

This makes it look as though you could just add a
  autoTabEFs = _false
to your setup, then check for dialog event _efTab.
I don't know where autoTabEFs is normally set--another search might 
give a clue.

Unless some code is resetting autoTabEFs, that might work.

  e-e
  =J= a  y
   "