Italian Focus

Discussion in 'Italian Forum' started by moore_it, Aug 8, 2018.

  1. moore_it

    moore_it Active Member Licensed User

    Ciao a tutti,
    avrei bisogno di disattivare il focus attivato via TAB su tutti i controlli esclusi i TextFields.
    Secondo voi è possibile ?

    Grazie
     
  2. LucaMs

    LucaMs Expert Licensed User

    Prova:

    Code:
    For Each vw As View In Activity.GetAllViewsRecursive
        
    If Not(vw Is EditTextThen
            SetFocusable(vw, 
    False)
        
    End If
     
    Next
    Code:
    Sub SetFocusable(Vw As View, Focusable As Boolean)
        
    Dim obj1 As Reflector
        obj1.Target = Vw
        
    If Focusable Then
            obj1.RunMethod2(
    "setFocusable""True""java.lang.boolean")
        
    Else
            obj1.RunMethod2(
    "setFocusable""False""java.lang.boolean")
        
    End If
    End Sub
     
    sirjo66 likes this.
  3. moore_it

    moore_it Active Member Licensed User

    Grazie LucaMS.
     
  4. LucaMs

    LucaMs Expert Licensed User

    Di niente.
     
  5. moore_it

    moore_it Active Member Licensed User

    Ultima cosa se può servire ...
    In b4J nel codice di LucaMs va modificata la view in node e il metodo da usare è setFocusTraversable che è comune a tutti gli oggetti.

    Code:
    For Each n As Node In MainForm.RootPane.GetAllViewsRecursive
           
    If Not(n Is TextFieldThen
               
    Log(n)
               Globals.SetFocusable(n, 
    False)
           
    End If
    Next
    Code:
    Sub SetFocusable(n As Node, Focusable As Boolean)
        
    Dim obj1 As Reflector
        obj1.Target = n
        
    If Focusable Then
            obj1.RunMethod2(
    "setFocusTraversable""True""java.lang.boolean")
        
    Else
            obj1.RunMethod2(
    "setFocusTraversable""False""java.lang.boolean")
        
    End If
    End Sub
     
    sirjo66 and LucaMs like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice