iOS Question CustomListView does return the correct Index and Value

Keith Yong

Active Member
Licensed User
Longtime User
Hi,

I build a library for dialog for my own use. In the dialog has customlistview, when i click on the customlistview, it doesn't return the correct index, it always return the last index that i added.

2nd issue, as you can see the attachment picture. The header is not under customlistview, but when i click on the header, it did fire the customlistview_itemclick

I attach here a coding, can you let me know what am i did wrong?
 

Attachments

  • Dialog.zip
    56.6 KB · Views: 162
  • Screen Shot 2018-07-08 at 4.27.11 AM.png
    Screen Shot 2018-07-08 at 4.27.11 AM.png
    115 KB · Views: 148

Keith Yong

Active Member
Licensed User
Longtime User
The first step is to remove the old CustomListView module and only use xCustomListView library.
In the project i didn't include the CustomListView and already use xCustomListView library, but the problem remain the same.
 
Upvote 0

Keith Yong

Active Member
Licensed User
Longtime User
i think something wrong somewhere. I did not make changes and the customlistview back to problem again. As you can see the attachment, i'm actually click on the header, but last row was selected.

Just now was working fine for a while...:(
 

Attachments

  • Screen Shot 2018-07-08 at 3.45.34 PM.png
    Screen Shot 2018-07-08 at 3.45.34 PM.png
    183.8 KB · Views: 138
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. I recommend you to use the visual designer to create the layout. It will be simpler and more flexible. You shouldn't assume that the page size is constant.

2. Never initialize an object and then assign a new object to the same variable:
B4X:
Dim m As Map: m.initialize
       m = Lst.Get(i)
It should be:
B4X:
Dim m As Map = Lst.Get(i)

This code:
B4X:
Dim mDlg As Map: mDlg.Initialize
   mDlg.Put("Value", "444")
   mDlg.Put("Display", "444")
   lstDlg.Add(mDlg)
Can be written like this:
B4X:
lstDlg.Add(CreateMap("Value": "444", "Display", "444"))
It is shorter and safer.


I ran your project and wasn't able to reproduce the issue you described.
 
Upvote 0

Keith Yong

Active Member
Licensed User
Longtime User
1. I recommend you to use the visual designer to create the layout. It will be simpler and more flexible. You shouldn't assume that the page size is constant.

2. Never initialize an object and then assign a new object to the same variable:
B4X:
Dim m As Map: m.initialize
       m = Lst.Get(i)
It should be:
B4X:
Dim m As Map = Lst.Get(i)

This code:
B4X:
Dim mDlg As Map: mDlg.Initialize
   mDlg.Put("Value", "444")
   mDlg.Put("Display", "444")
   lstDlg.Add(mDlg)
Can be written like this:
B4X:
lstDlg.Add(CreateMap("Value": "444", "Display", "444"))
It is shorter and safer.


I ran your project and wasn't able to reproduce the issue you described.


Thanks for your advise. Actually i remove the control virtual designer and re-put it again, now is working fine after several test..:)
 
Upvote 0
Top