Android Question CustomDialog and events

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi to all
My idea was to have a CustomDialog with some Buttons and EditTexts inside. The Buttons should be used for opening a list of strings, one of which must be inserted on the corresponding EditText. (Something like a "Browse" Button for a file list, but simpler; in my case the strings are not File Names, mine was just an example of the mechanism).
The problem is that the Click event of the buttons doesn't fire. Then I searched the forum finding an example of inserting a button on a panel and copied it. It works, obviously, but in the example the panel is added directly to the Activity, while, in my case, it is added to the CustomDialog. I prepared a test project that I attach here. There are two Views: one is a Button and one is an EditText. The reason for testing two types of views is that I discovered this problem while developing my App, and, in this case, the Button click event doesn't fire, while the EditText click event, yes. Therefore I was thinking that the problem was related only to Button clicks, but, in the Test project, instead, no event fires, neither on Button nor on EditText. This adds mistery, but forget about.
NOTE: Clearly things can be made just using a Panel and adding it directly to Activity, this is not the concern, but I am wondering whether I am missing something .. as usual..
Thanks for reading. Have a nice Week End..
 

Attachments

  • TestClick.zip
    8.5 KB · Views: 216

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. Just passed to using B4XDialog and got same behavior, namely that the Button event click is not fired in the App that I am developing. Nevertheless, the test App, modified same way, works. Therefore we cannot discuss further basing on it. The fact that Main App fails, while test App works, could mean that also the old CustomDialogs could work (despite I decided to forget about it). As a matter of fact the problem remains.
The only explanation is that the structure of my App is different from that of the test App. I guess that the main difference could be that, while in the test App I use XUIView based dialog having Activity as parent and display it over Activity, in my Main App it is shown over a GoogleMaps MapFragment, though having Activity as parent. In practice, when user taps on a location on the MapFragment, I have to open a dialog asking some data. In the panel, I have some EditTexts and Buttons. Curiously, a click on an EditText opens, at first, the keyboard, but, clicking again, fires the Edit_Click event. With the Button there is nothing to do. I am checking this with the debugger, putting a break-point. I must further investigate. Mine was just a comment, because uploading the Main App here is not possible. Thanks for reading.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Finally I found the bug in my code. Trivially another view was partially covering the incriminated Button surface. That view consumed the click event instead of the button.. Therefore the only conclusion is that everything works and Perhaps also old CustomDialog lib worked. Sorry.
 
Upvote 0
Top