B4J Question Not call event in listview

Discussion in 'B4J Questions' started by omidaghakhani1368, Apr 11, 2015.

  1. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Hi.
    I add item to listview and i can handle selected index of listview
    But when i have a one item in listview and if i select it,event of listview execute
    but when again click on item,event of listview not execute
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The event only fires when the selected index has changed.

    You can add custom views to the list and then handle their events instead.
     
  3. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    I know.It's working good when item count is above 1 item,
    But in one item not work if once click on item
    I think that if i add blank item to listview then it is ok,isn't?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It is probably considered selected before you clicked it. Check the value of SelectedIndex. Try to set it to -1.
     
  5. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    OK thank you
     
  6. Patent

    Patent Member Licensed User

    is there a similar solution for a treeview_SelectedItemChanged event?
    First click fires.
    Second not - for sure.
    How can i "Clear" the Index for the Item?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Note that you should have started a new thread for this question.

    Try this:
    Code:
    Dim jo As JavaObject = TreeView1
    jo.RunMethodJO(
    "getSelectionModel"Null).RunMethod("clearSelection"Null)
     
  8. Patent

    Patent Member Licensed User

    Thank you Erel,

    that is the right direction for me.

    A little trap hint for all who are interested:
    Because of the listener is allready working, the "clearSelection" Method fires the "treeview1_SelectedItemChanged" Event with Selection= -1, which
    could cause an Exeption if not intercepted.
     
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