Best way to implement a long click menu

Gmankelow

Member
Licensed User
Longtime User
I am new to Basic4Android but from what I have seen so far loving it.

What I am trying to do is create a list of Words then allow the user to long click on the word to edit it, delete it or even move it up and down.

So far I have a ListView and have populated it with data from a txt file, I am unsure now of the 'correct' way to implement the long click menu to give the user a type of short cut menu to the word options.

Any help would be appreciated.
 

Brad

Active Member
Licensed User
Longtime User
Very simple! In the designer click on Tools -> Generate Members. check the box next to your listview then click the '+' and expand the tree and check the 'ItemLongClick' box. This will create a ItemLongClick sub where you enter your code.
 
Upvote 0

Gmankelow

Member
Licensed User
Longtime User
Brad,

Thanks, I had seen that event and was planning on using it but it was what's the best way of creating the shortcut menu.

What I am currently planning is a panel view with buttons on it which I have as hidden initially and becomes visible on a long click.

Just wanted to ask the community if that was the best option.

Thanks
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
One thing to be aware of is that if your panel is not full screen size, buttons visible on the activity, or a panel below the menu will still be active and clickable.

One way to stop this is to make the pop up panel transparent and the full size of the screen. Then intercept clicks to the background buttons with click and long_click subs for the pop up panel. They can be empty, but just need to be there so the buttons below don't get the clicks.

If you want to see a panel, add a second one which is visible and the colour and size you want and then put the menu items on that.

Steve
 
Upvote 0
Top