Button and AutoCompleteEditText stopped working

Caravelle

Active Member
Licensed User
Longtime User
Can anyone please suggest what could make a button and an AutoCompleteEditText stop responding to clicks ? I can accept that I might change things while developing an app that might have unexpected consequences, but I need to know where to look for the fault. It is as if something has disabled these two views, but both are initialised as Enabled in the Designer, and the code relating to them is self-contained and unchanged - nothing else in the program refers to these views. This code proves that no click is being registered:

B4X:
Sub btnDate_Click                                    
   Log("Date button clicked")   ' nothing shown in log
        ' rest of sub commented out
End Sub

I have not changed any code that relates to the two items, which were both working fine. Other views on the same panel are still working fine. I'm not getting any error messages. I thought the problem might have something to do with another panel hidden underneath, but I moved it so the two panels are separated and the two dead views remain apparently disabled. I can't attach the entire working code as it relies on a large multi-table database. I can try to prepare a cut-down version but it will take a long time. So at this stage I'd be grateful for some ideas as to what could possibly have gone wrong.

Thanks in advance

Caravelle
 

Caravelle

Active Member
Licensed User
Longtime User
Thank you, Erel. Yes "BtnDate" has Event Name "BtnDate", and "ACTxtLocn" has Event Name "ACTxtLocn". The Designer also still shows them as still having the correct Parent, "PnlLog". Nothing there has changed since they were working.

No, there is no visualization when either component is clicked.

But, good news. I have experimented by moving things around on the panel. I have a working EditText and Button at the top of the panel. If I swap them around with the dead views, suddenly the previously-dead ones start working and the previously-working ones die ! If one of the dead components is put at the top of the panel with the two working ones, then it too starts to work. So the cause of the views becoming unresponsive is obviously their position on the panel - which apart from my recent experimenting hasn't changed since when they were working.

I am concluding that the cause of the trouble is a ListView2: this is added by code and does not show in the designer so is easily forgotten. Its basic rectangle does indeed cover where the two affected views are placed. I can move the two views to below the space set aside for the ListView2 and they work again.

So, I have a working app, but it looks a bit strange with most of the screen empty most of the time - the ListView2 only visually appears when called up and then only if there is any relevant data to display. So the answer seems to be to keep the ListView2 height to a bare minimum when it is not being used, and resize it when needed, or a series of .SendToBack and .SendToFront commands, or even to only .Add it to the Panel when needed and remove it when not. As to why this wasn't necessary before but has become necessary now that will have to remain a mystery I think. I posted a query the other day involving this ListView2, maybe I tinkered with its settings when I had a problem with it - I really don't remember. Age is not being kind to my brain cells.

Thanks again.

Caravelle
 
Upvote 0
Top