How to do away the buttons in customdialog..

ahwong

Member
Licensed User
Longtime User
I added a listview to the customdialog and I want it to return the listview item that I click. The dialog should be closed upon selection. How to do that?

Thanks in advance..

B4X:
Sub Globals
  Dim pos As Int
End Sub

Sub Activity_Create(FirstTime As Boolean)
  Dim btn As Button
  btn.Initialize("btn")
  btn.Text="click me"
  Activity.AddView(btn,0,0,100dip,50dip)
End Sub

Sub btn_Click
  Dim i As Int 
  Dim lv As ListView
  Dim cd As CustomDialog2
  lv.Initialize("lv")
  For i=0 To 99
    lv.AddSingleLine("Item : " & i)
  Next
  cd.AddView(lv, 77%x, 70%y)
  ret = cd.Show("B4A Custom Dialog", "", "OK", "", Null) + pos
  Msgbox(ret,"selection")
End Sub

Sub lv_ItemClick (Position As Int, Value As Object)
  pos = Position
End Sub
 

derez

Expert
Licensed User
Longtime User
Search "inputlist" and see this:

It is a simple display like a spinner, not capable of different typeface for each item, but it does not require any layout definitions.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…