B4J Question How to get some information from multiple selected object in tableview?

Discussion in 'B4J Questions' started by prhymery, Jul 25, 2018.

  1. prhymery

    prhymery Member

    I made a tableview and I stored numbers in each cells as object

    when I clicked some cell, I got number(object info) of each cells by using below method

    Code:
    Sub TableView1_SelectedCellChanged (RowIndex As Int, ColIndex As Int, Cell As Object)
        
    Log(Cell)
    End Sub
    Then, I am trying to get numbers (objects info) during the multiple selection

    is there any way to get information from multiple selected cells?

    I used below code from table example

    Code:
    Dim jotable As JavaObject=TableView1
       
        
    Dim joSelMode As JavaObject
        joSelMode.InitializeStatic(
    "javafx.scene.control.SelectionMode")
       
        
    Dim tvSelModel As JavaObject = jotable.RunMethodJO("getSelectionModel"Null)
       
        tvSelModel.RunMethod(
    "setSelectionMode",Array(joSelMode.GetField("MULTIPLE")))
     
    Last edited: Jul 25, 2018
  2. PatrikCavina

    PatrikCavina Active Member Licensed User

  3. Erel

    Erel Administrator Staff Member Licensed User

    Another option is to add nodes to the table cells and then you can do more sophisticated things. You can for example add a CheckBox near each item.
     
    prhymery likes this.
  4. prhymery

    prhymery Member

  5. prhymery

    prhymery Member

    Thanks Erel
    how can I add nodes to the table cell?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

  7. prhymery

    prhymery Member

    Thank you for your quick response
    Actually, I already made a node like below code
    Code:
    For rowIndex = 1 To 16
            
    Dim row(TableView1.ColumnsCount) As Object
            
    Dim num As Int
            
    If rowIndex = 1 Then
            num=rowIndex
            
    Else If rowIndex <> 1 Then
                num = (
    32*(rowIndex-1))+1
            
    End If
                
    For c = 0 To TableView1.ColumnsCount - 1
                    row(c) = num + c
                
    Next
            TableView1.Items.Add(row)
        
    Next
    you mean, should I add labels?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    You are not creating nodes / controls / views. See the tutorial. Instead of creating labels you can create panes with many other views.
     
    prhymery likes this.
  9. PatrikCavina

    PatrikCavina Active Member Licensed User

    Attached the example of you need.
    Based on JavaObject
     

    Attached Files:

    DonManfred and prhymery like this.
  10. prhymery

    prhymery Member

    Sorry Erel, I'll watch the tutorial and try this again.
    I appreciate your help, Thanks.
     
  11. prhymery

    prhymery Member

    Thanks a lot PatrikCavina.
    I'm going to analyze your example.
    This is what I want! perfect.
    Have a nice day~ :)
     
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