Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there any way to UnFocus()?
Message
De
08/07/2003 15:46:03
 
 
À
08/07/2003 14:52:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00808129
Message ID:
00808203
Vues:
10
Hi Pamela,
That's pretty much how I did it. Just have to check for loControl having a TabIndex (BaseClass custom doesn't have a TabIndex) and Enabled and Visible. Also have to check if This.TabIndex is the last one in This.Parent.Controls so you can set it to the 1st on in Parent.
I was hoping there was an easier way.
Here's what I'm using until I find an easier way:
LOCAL lo, lnThis, lnNext, lnIndex, laIndex(1)
lnThis = THIS.TABINDEX
lnIndex = 0
FOR EACH lo IN THIS.PARENT.OBJECTS
  IF lo # THIS ;
      AND TYPE( 'lo.TABINDEX' ) = 'N' ;
      AND lo.ENABLED ;
      AND lo.VISIBLE
    lnIndex = lnIndex + 1
    DIMENSION laIndex( lnIndex, 2 )
    laIndex( lnIndex, 1 ) = lo
    laIndex( lnIndex, 2 ) = lo.TABINDEX
  ENDIF
ENDFOR
= ASORT( laIndex, 2 )
FOR lnIndex = 1 TO ALEN( laIndex, 1 )
  IF laIndex( lnIndex, 2 ) > lnThis
    laIndex( lnIndex, 1 ).SETFOCUS()
    EXIT
  ENDIF
ENDFOR
IF lnIndex > ALEN( laIndex, 1 )
  laIndex( 1, 1 ).SETFOCUS()
ENDIF
>Hi Bill,
>
>This is untested, but how about something like:
>
>
>FOR EACH loControl in This.Parent.Controls
>   IF loControl.TabIndex = This.TabIndex + 1
>      loControl.SetFocus()
>   ENDIF
>ENDFOR
>
>pamela
>
>>Is there any convenient way for a container to setfocus OFF itself or any of it's Objects?
>>
>>Specifically, I want a cmdButton.Click() on a container to force the container.GotFocus() to trigger if the user tries to access any of the controls on the container after the cmdButton.
>>
>>container.cmdButton.click()
>>  .....
>>  this.parent.Remove_Focus()
>>endproc
>>
>>container.Remove_Focus()
>>  ????  && move focus to a control not in the container
>>        &&   preferably the one next in tabindex order
>>endproc
>>
>>container.GotFocus()
>>  if <some condition>
>>    this.cmdButton.enabled = .f.
>>    this.other_control.enabled = .t.
>>  else
>>    this.cmdButton.enabled = .t.
>>    this.other_control.enabled = .f.
>>  endif
>>endproc
>>
>>TIA
Bill Morris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform