Dim checkValue As AnotherDatePicker
checkValue = Sender
Log(checkValue)
as per your suggestion i created desried ADPs at run time like this.( it works..)In which way doesn't it work? What is the output?
Pickers(y) = adp
Pickers(y).AddToActivity(Activity, VM4.GetView("sDate"&y))
VM4.AddButton(-2, -1, -1, 1, "sDateBtn"&y, "Set Date", 16, Colors.Black, "sDate_Click", Me)
Pickers(sender).show
Sub sDate_Click
Pickers(1).Show
End Sub
tried it like this
B4X:Dim checkValue As AnotherDatePicker checkValue = Sender Log(checkValue)
but failed, please help as i am stuck here
How do you discern one picker from another?
If for example your original pickers have a Tag with 'Pic1', 'Pic2' and so on, the 3rd line of your code will something like
If checkValue.Tag = "Pic1" then...
Sub Globals
Dim adp(2) As AnotherDatePicker
.... more code here
End Sub
Sub Activity_Create(FirstTime As Boolean)
....
adp(0).AddToActivity(Activity, VM1.GetView("sDate"))
.....
adp(1).AddToActivity(Activity, VM1.GetView("eDate"))
....
End Sub
Sub sDate_Click
adp(0).Show
End Sub
Sub eDate_Click
adp(1).Show
End Sub
@Straker can you post a screenshot? Does it also happen with the original AnotherDatePicker?
thanks for taking interest , i am also trying it at my end.Mmmm... I tested the same program on another device and it is the same as above. So I think that is something in the program...
i have corrected this issue already, but the problem is with to catch the id of VM4.GetView("sDateBtn"&y)I've downloaded and tested your adpTest.zip
In that source you are using the same adp twice. The first time you assign the adp to sDate and the second time you assign the adp to eDate.
When the user click on the 'Set Date" button, the adp is shown, but the result will always be send to the eDate which is currently linked to the adp.
You need to use 2 adp and link adp(0) to sDate and adp(1) the eDate.
B4X:Sub Globals Dim adp(2) As AnotherDatePicker .... more code here End Sub Sub Activity_Create(FirstTime As Boolean) .... adp(0).AddToActivity(Activity, VM1.GetView("sDate")) ..... adp(1).AddToActivity(Activity, VM1.GetView("eDate")) .... End Sub Sub sDate_Click adp(0).Show End Sub Sub eDate_Click adp(1).Show End Sub
Sender returns the adp itself. Not the index.
You can add a Tag property to adp to help you distinguish between them:
@Straker can you post a screenshot? Does it also happen with the original AnotherDatePicker?B4X:Dim adp As AnotherDatePicker = Sender Log(adp.Tag)