Android Question B4xtable - adding submenu on click

DarkoT

Member
Licensed User
Hi guys,

I need info... It's possible to add "submenu" into B4X table grid as submenu; which appears on CellLongClick from existing record in grid and user can choice which functionality will use...

Thank you for help...

Br, DaT
 

mangojack

Well-Known Member
Licensed User
One solution if I understand correctly ...

Add a Spinner to the Column Cells ....

See this thread ... replace the ImageView / Flag with your spinner.
 

DarkoT

Member
Licensed User
One solution if I understand correctly ...

Add a Spinner to the Column Cells ....

See this thread ... replace the ImageView / Flag with your spinner.
Uf, maybe I was not precise enough... I want to add new functionality to GridView; when user use "longclick" on some record in grid, system will open "left menu" - like this:

1602492819629.png



Can I add this "submenu" into Grid logic?

Regards,
Darko
 

mangojack

Well-Known Member
Licensed User
For the Menu .. possibly just some labels added to a panel

You could calculate the top position from VisibleRowID ... but unsure of method to calculate left position. (especially if user starts scrolling)
* but you would also have to allow / recalculate if user long clicks last few rows ..

B4X:
Sub B4XTable1_CellLongClicked (ColumnId As String, RowId As Long)
	Dim visibleRowID As Int = B4XTable1.VisibleRowIds.IndexOf(RowId)
	pnlMenu.Visible = True
	pnlMenu.SetLayoutAnimated(0, 100dip, 140dip +(visibleRowID * 42dip) , 100dip, 100dip) 'Top value .. 140dip for header height
End Sub
 
Last edited:

DarkoT

Member
Licensed User
For the Menu .. possibly just some labels added to a panel

You could calculate the top position from VisibleRowID ... but unsure of method to calculate left position. (especially if user starts scrolling)
* but you would also have to allow / recalculate if user long clicks last few rows ..

B4X:
Sub B4XTable1_CellLongClicked (ColumnId As String, RowId As Long)
    Dim visibleRowID As Int = B4XTable1.VisibleRowIds.IndexOf(RowId)
    pnlMenu.Visible = True
    pnlMenu.SetLayoutAnimated(0, 100dip, 140dip +(visibleRowID * 42dip) , 100dip, 100dip) 'Top value .. 140dip for header height
End Sub
Thanks ... Have you any example with panel? What should be a part of panel? Fixed text or grid? I need to add more (5 - 8 "lines" to menu)...
I'm new with android programming, so - need more help... ;)

Regards, DaT
 

mangojack

Well-Known Member
Licensed User
Thanks ... Have you any example with panel? What should be a part of panel? Fixed text or grid? I need to add more (5 - 8 "lines" to menu)...
I'm new with android programming, so - need more help... ;)
Have you read the Guides and tutorials... further down is a link for Video Tutorials as well.


I have attached a small example that supplies a menu on Long_Click of the first Column cells. It has been restricted to the first column only.
Adapt it to your needs. It has been commented well.
I have not tested the accurate positioning of the menu across devices.

I have seen an example of balloon shaped panel / view in the forum if that interests you. (Have not searched)
There is probably other views that could be used as a menu as well.
 

Attachments

DarkoT

Member
Licensed User
Have you read the Guides and tutorials... further down is a link for Video Tutorials as well.


I have attached a small example that supplies a menu on Long_Click of the first Column cells. It has been restricted to the first column only.
Adapt it to your needs. It has been commented well.
I have not tested the accurate positioning of the menu across devices.

I have seen an example of balloon shaped panel / view in the forum if that interests you. (Have not searched)
There is probably other views that could be used as a menu as well.
Clear...
Thx...
 
Top