Modal ListView

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I see Andrew Graham's Dialogs library, and the discussion that goes along with it.

I would like to make a ListView (LV) to act as kind of the equivalent of a Windows Drop List. the LV would accept an array of strings, would show a modal LV, return the string value of the item that was clicked and close allowing the calling routine to continue.

The difference between this and a dialog is that no "OK" button needs to be pressed.

Is there an example of how to implement a Modal dialog? DoEvents is not quite right, using a timer is not quite right, stringing subroutines is not quite right – AG speaks of using the MessageBox modal mechanism. Is there a description of this?

I find that I frequently want to do something like this – a WaitFor or a Sleep. Any suggestions or hints?

Thanks,
Barry.
 

thedesolatesoul

Expert
Licensed User
Longtime User
The problem with a Modal dialog is: It is waiting for user input so you need to sleep until the user does something.
Usually if this is too long Android will display a Application Not Responding error and kill your app.

You are probably looking for an Inputlist: Basic4android - Core
This is part of the core library.

I also did a library a while back (badly documented) that does the same thing but removes the Radiobuttons.
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
Usually if this is too long Android will display a Application Not Responding error and kill your app.

You are probably looking for an Inputlist: Basic4android - Core
This is part of the core library.

I also did a library a while back (badly documented) that does the same thing but removes the Radiobuttons.

Thanks, I will look for those two. How does the dialogue library get around the problem of Android going on a killing rampage?

Barry.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
I have used this method:

When the "modal" dialog is called

1) Add a full size transparent panel to the app that catches all the clicks (this ensures nothing else can be activated whilst the "dialog" is showing)

2) Add the controls - in this case a listview - to the above panel.

3) have the ListView.ItemClick set to remove the listview and the panel when an item has been selected.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Thanks, I will look for those two. How does the dialogue library get around the problem of Android going on a killing rampage?
I am not sure. They use some kind of DoEvents that lets them process the message queue even when the modal dialog is shown.


I have used this method:

When the "modal" dialog is called

1) Add a full size transparent panel to the app that catches all the clicks (this ensures nothing else can be activated whilst the "dialog" is showing)

2) Add the controls - in this case a listview - to the above panel.

3) have the ListView.ItemClick set to remove the listview and the panel when an item has been selected.
I tried this method as well. It is a little bit more work but more flexible.
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
I am not sure. They use some kind of DoEvents that lets them process the message queue even when the modal dialog is shown.

Thanks again. I found the id.zip and it looks to be exactly what I need.


Added a few minutes later…

Fantastic!


Barry.
 
Last edited:
Upvote 0
Top