iOS Question PlacesAutocompleteView _SelectChanged doesnt fire

Status
Not open for further replies.

Tomas Petrus

Active Member
Licensed User
Longtime User
using customized PlacesAutocompleteView and event

B4X:
Private Sub lv_SelectedChanged (SectionIndex As Int, Cell As TableCell)
    Dim pd As PlaceData = Cell.Tag
    et.Text = pd.Description
    lv.Visible = False
    et.ResignFocus
    CallSubDelayed2(mCallback, mEventName & "_ItemClick", pd)
End Sub

doesnt even fire when i select something from the suggests

any ideas ?
 

Tomas Petrus

Active Member
Licensed User
Longtime User
It was the first thing I did.. and it didnt stop
I didnt believe it so I put also Log() inside the sub but again nothing.
And after that I made this post

It seems that the event is not raised at all and I dont know how to debug it. Neither where to look for clues.
 
Upvote 0

Tomas Petrus

Active Member
Licensed User
Longtime User
Well that was what I did in first place I took my Android and changed it according to this example.
Checked again... example works mine project dont..

Finally I found that the Panel that encapsulating this view is stealing the clicks.. so for purpose of testing I comented click function on parent panel.
And I found out that the click on
B4X:
Private Sub lv_SelectedChanged (SectionIndex As Int, Cell As TableCell)
really doesnt work

The changed class AutocomleteView is working - tested in example.

Autocomplete works it suggest the things...
Just cant click on any of the items...

B4X:
Sub NaseptavacShow (misto As String)
    'PageObjednavka.RootPanel.LoadLayout("naseptavac")
    NaseptNoClickPnl.LoadLayout("naseptavac")
    NaseptNoClickPnl.Visible = True
    NaseptNoClickPnl.Alpha = 1
  
    If misto = "nastup" Then
      
        NaseptNastupPnl.BringToFront
        NaseptNastupPnl.Visible = True

        PlacesAutocompleteView1.et.Visible = True
        PlacesAutocompleteView1.et.RequestFocus

        ' tried but it doesnt work
        PlacesAutocompleteView1.lv.BringToFront
        PlacesAutocompleteView1.lv.RequestFocus
    End If
End Sub

except of how I load / display the layouts the code looks the same to me

NaseptNastupPnl is the Parent panel for the autocomplete

any ideas ?
 
Upvote 0

Tomas Petrus

Active Member
Licensed User
Longtime User
I made et in the class Public so I can work with it from Main... and its working fine you can click inside, keyboard is shown you can write, the suggest is shown you can read it just cant click...

So I tried to make lv public and bring it to front

even tried
B4X:
PlacesAutocompleteView1.lv.UserInteractionEnabled = True

still no luck
 
Upvote 0

Tomas Petrus

Active Member
Licensed User
Longtime User
Problem found .. but still dont understand it

I had to comment 2 click events on the page where I am showing the autoplacedialog
B4X:
Sub PageObjednavka_click
        
End Sub
- dont remember the reason why this is there - maybe it doesnt have any reason in B4i ?

I had to coment also the
B4X:
Sub NaseptNoClickPnl_Click
    NaseptNoClickPnl.SetAlphaAnimated(500,0)
End Sub

this is for the main panel and it was serving in B4a like close button - if you click outside the right part of UI the dialogs with the sugestions are closed.

When I comment both of this _click events
this event is finally working

B4X:
Private Sub lv_SelectedChanged (SectionIndex As Int, Cell As TableCell)
    LogColor("SELECTED auto",Colors.Red)
    Dim pd As PlaceData = Cell.Tag
    et.Text = pd.Description
    lv.Visible = False
    et.ResignFocus
    CallSubDelayed2(mCallback, mEventName & "_ItemClick", pd)
End Sub

Can u please explain me why the page or parent panel that are by my point of view behind lv object are stealing my lv_clicks ?
and is there any workaround ?
 
Upvote 0

Tomas Petrus

Active Member
Licensed User
Longtime User
When I take your example and change just the following in Main
B4X:
Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    'Page1.RootPanel.LoadLayout("1")
    Page1.RootPanel.LoadLayout("default")
    NavControl.ShowPage(Page1)
    Panel1Pnl.LoadLayout("1")
End Sub

Private Sub Panel1Pnl_Click
    Log("Click Stealer")
End Sub

then the click stealer happens all the time when you click on item in the suggested list
 
Upvote 0

Tomas Petrus

Active Member
Licensed User
Longtime User
I dont understand : (

So in B4i can I handle click on the parent panel and in the same time handle the click on lv Item in autocomplete ?
if YES ... so did you mean to change this in AutocomleteView class

B4X:
Private Sub lv_SelectedChanged (SectionIndex As Int, Cell As TableCell)

to something like
B4X:
Private Sub lv_TouchItem (SectionIndex As Int, Cell As TableCell)
or something like that ?? to make it fire ?

I am really lost...
 
Upvote 0
Status
Not open for further replies.
Top