B4J Question TreeView Method: getItem not found

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Every time I click on the Horz ScrollBar (the blank area between arrows)
(RuntimeException) java.lang.RuntimeException: Method: getItem not found in: javafx.scene.layout.StackPane

If I click on the Arrows I get
(RuntimeException) java.lang.RuntimeException: Method: getItem not found in: javafx.scene.layout.Region

The Scroll Box scrolls - Do I / Am I suppose to handle these routines? If so how?
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
B4X:
Dim nw As JavaObject = PickResult.RunMethod("getIntersectedNode", Null)

getIntersectedNode seems to return a different nw type for clicking on a column then for clicking on a scroll bar.

Is there a way to determine what is being returned?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
The only way I could figure to make the routine from this page (https://www.b4x.com/android/forum/threads/mouse-click-on-imageview-in-tableview.86341/#post-546793) work properly was this

B4X:
Sub TableView_Filter(e As Event)
   Try
     Dim jo As JavaObject = e
     Dim PickResult As JavaObject = jo.RunMethod("getPickResult", Null)

     Dim toString    As String = PickResult.RunMethod("toString", Null)

     '---------------------------------------------------------------------------------
     '  If NOT a  TableColumn then probably something like a scrollbar 
     '---------------------------------------------------------------------------------                   
     If  toString.Contains("TableColumn")  =  false Then return

     If PickResult.IsInitialized Then
       Dim nw As JavaObject = PickResult.RunMethod("getIntersectedNode", Null)
       If nw.IsInitialized Then
         '-------------------------------------------------------------------------------
         '  Without the toString check for TableColumn above this routine 
         '              getItem below crashes when clicking on the scrollbars
         '-------------------------------------------------------------------------------
         Dim item As Object = nw.RunMethod("getItem", Null)

         If item Is ImageView Then
           Dim iv As ImageView = item
           'your image view is here.
           Log("Found: " & iv)
           e.Consume
         End If
       End If
     End If
   Catch
     Log(LastException)
   End Try
End Sub
 
Upvote 0
Top